Simple Expand/Collapse


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your HTML
  1. $("#expandable_content a.trigger").click(function() {
  2. var selection=$(this).next("div.section")
  3. if ($(selection).hasClass("expanded")) {
  4. $(this).next("div.section")
  5. .slideUp(700)
  6. .addClass("collapsed")
  7. .removeClass("expanded")
  8. }
  9. else {
  10. $(this).next("div.section")
  11. .slideDown(700)
  12. .addClass("expanded")
  13. .removeClass("collapsed")
  14. }
  15. })

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.