jquery show/hide/toggle etc.
Posted
by Ray
on Stack Overflow
See other posts from Stack Overflow
or by Ray
Published on 2010-06-11T22:01:52Z
Indexed on
2010/06/11
22:13 UTC
Read the original article
Hit count: 246
JQUERY:
$("li h2").click(function() {
$(this).toggleClass("active").siblings().removeClass("active");
$(this).next("div").slideToggle("fast").siblings("div").slideUp("fast");
});
HTML:
<ul>
<li>
<h2>headingA</h2>
<div>contentA</div>
<h2>headingB</h2>
<div>contentB</div>
</li>
</ul>
NOTES: Bascially I'd want: when click on h2 show the div next to it and hide all others, not only show/hide toggle as well. thanks!
© Stack Overflow or respective owner