[jQuery] Accordion Header Image Replacement
I have a simple accordion set up with the code below, but I want to be
able to change the header's background image from an up arrow state to
down arrow state and back automatically. Any ideas on where to go from
here?
$(document).ready(function() {
$('div.acc> div').hide();
$('div.acc> h1').click(function() {
var $nextDiv = $(this).next();
var $visibleSiblings = $nextDiv.siblings('div:visible');
if ($visibleSiblings.length ) {
$visibleSiblings.slideUp('slow', function() {
$nextDiv.slideToggle('slow');
});
} else {
$nextDiv.slideToggle('slow');
}
});
});
-------------------------------------
<div class="acc">
<h1>Test</h1>
<div>Hidden Text</div>
<h1>Test</h1>
<div>Hidden Text</div>
</div>