/ Published in: jQuery
inspired by boagworld.com
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$("dd:not(:first)").hide(); $("dt a").click(function() { if ($(this).parent().next().is(":hidden")) { $("dd:visible").slideUp(); $(this).parent().next().slideDown(); } return false; }); // HTML: // <dl> // <dt><a href="#">definition term</a></dt> // <dd>definition description</dd> // <dt><a href="#">definition term</a></dt> // <dd>definition description</dd> // <dt><a href="#">definition term</a></dt> // <dd>definition description</dd> // </dl>