Using 'toggleClass()' and providing effects in JQuery

Goud.Kv
Posted by Goud.Kv under jQuery category on | Points: 40 | Views : 273
Below code snippet explains how to switch the css class files on mouse click and generating effects in JQuery.


<script type="text/javascript">
$(function () {
var zone = $(".post");
$("#Post").css({ cursor: "pointer" }).on("click", function () {
zone.toggleClass("postshow", "post");
});
});
</script>


In the above code., on clicking the 'post' class object, it toggles to 'postshow' class and so on.

Comments or Responses

Login to post response