jQuery Accordion Menu
Hi all
I’m using a simply Accordion menu with a div for the button and a div for the content.
[url]http://www.ttmt.org.uk/forum/
HTML
[code]
<div class=”sideNavBtn”>
<h2>Button One </h2>
</div>
<div class=”sideNavContent”>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. *** sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu,
</p>
</div>
jQuery
[code]
<script type=”text/javascript” charset=”utf-8″>
$(‘div.sideNavBtn’).click(function() {
$(‘div.sideNavBtn h2’).css(‘color’,’#666′);
$(this).css(‘color’,’red’);
$(‘div.sideNavContent’).slideUp(‘normal’);
$(this).next().slideDown(‘normal’);
});
$(“div.sideNavContent”).hide();
</script>
The button div contains a h2 tag with the button name.
When the button is clicked I would like to change the color of that h2 tag.
How can I target the h2 tag of the button clicked. I want to do something like
[code]
$(this.h22).css(‘color’,’red’);
Also how can I have a slideToggle on the button so clicking will open and close the container and clicking another button will close any open container like it does now.