Posted By

amandalaine on 08/16/11


Tagged

collapse expand


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

jillella
spee66


Simple Expand/Collapse


 / Published in: jQuery
 

  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  

You need to login to post a comment.