/ Published in: jQuery
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<p><a href="#how-to" class="toggle">How to write a good article?</a></p> <div id="how-to"> How to tips go here. </div> $('a.toggle').toggle(function() { var id = $(this).attr("href"); $(this).addClass("active"); $(id).slideDown(); }, function() { var id = $(this).attr("href"); $(this).removeClass("active"); $(id).slideUp(); });
URL: http://eisabainyo.net/weblog/2010/09/01/10-useful-jquery-snippets/