
Untitled
By: a guest on
Aug 8th, 2012 | syntax:
None | size: 0.98 KB | hits: 6 | expires: Never
Vertical Navagation siblings not closing when another is opened
$('.vertical-nav ul li:has("div")').find('div').hide();
$('.vertical-nav li:has("div")').find('span:first').click(function() {
$(this).parent('li').find('span:first').toggleClass("closed opened");
if ($(this).parent('li').find('span:first').attr('class') == 'closed') {
$(this).parent('li').find('span:first').text('+');
} else {
$(this).parent('li').find('span:first').text('-');
}
$(this).parent('li').find('div:first').slideToggle();
});
$(this).closest('li').siblings().children('span.opened').click();
$('.vertical-nav li:has("div")').find('span:first').click(function() {
var $this = $(this);
$this.toggleClass("closed opened");
if ($this.hasClass('closed')) {
$this.text('+');
} else {
$this.text('-');
$this.closest('li').siblings().children('span.opened').click();
}
$this.closest('li').find('div').first().slideToggle();
});