jQuery + anchor based accordion
Out of context: Reply #4
- Started
- Last post
- 4 Responses
- ********0
Good thing about anchor is that when you type address manually, you'll get the panel expanded; I have accordion working already, but can't combine it with anchors or slideTo effect; here is my code for accordion:
$(document).ready(function() {
$('#box> div> div.content').hide();
$('#headerMain > div').slideDown('slow');
$('#box> div> h2').click(function() {
var $nextDiv = $(this).next();
//var $visibleSiblings = $nextDiv.siblings('#box> div.content:visible');var $visibleSiblings = $(this).parent().siblings('#box> div').children('div:visible');
if ($visibleSiblings.length ) {
$visibleSiblings.slideUp(500, function() {
$nextDiv.slideToggle(600);
});
} else {
$nextDiv.slideToggle(600);
}
});
});adev - thanks for example with nice effect ;)