jQuery Accordion


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

inspired by boagworld.com


Copy this code and paste it in your HTML
  1. $("dd:not(:first)").hide();
  2. $("dt a").click(function() {
  3. if ($(this).parent().next().is(":hidden")) {
  4. $("dd:visible").slideUp();
  5. $(this).parent().next().slideDown();
  6. }
  7. return false;
  8. });
  9.  
  10.  
  11. // HTML:
  12. // <dl>
  13. // <dt><a href="#">definition term</a></dt>
  14. // <dd>definition description</dd>
  15. // <dt><a href="#">definition term</a></dt>
  16. // <dd>definition description</dd>
  17. // <dt><a href="#">definition term</a></dt>
  18. // <dd>definition description</dd>
  19. // </dl>

URL: http://jsbin.com/ukuti

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.