Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 8th, 2012  |  syntax: None  |  size: 0.98 KB  |  hits: 6  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Vertical Navagation siblings not closing when another is opened
  2. $('.vertical-nav ul li:has("div")').find('div').hide();
  3.  
  4. $('.vertical-nav li:has("div")').find('span:first').click(function() {
  5.     $(this).parent('li').find('span:first').toggleClass("closed opened");
  6.     if ($(this).parent('li').find('span:first').attr('class') == 'closed') {
  7.         $(this).parent('li').find('span:first').text('+');
  8.     } else {
  9.         $(this).parent('li').find('span:first').text('-');
  10.     }
  11.     $(this).parent('li').find('div:first').slideToggle();
  12. });
  13.        
  14. $(this).closest('li').siblings().children('span.opened').click();
  15.        
  16. $('.vertical-nav li:has("div")').find('span:first').click(function() {
  17.     var $this = $(this);
  18.     $this.toggleClass("closed opened");
  19.     if ($this.hasClass('closed')) {
  20.         $this.text('+');
  21.     } else {
  22.         $this.text('-');
  23.         $this.closest('li').siblings().children('span.opened').click();
  24.     }
  25.     $this.closest('li').find('div').first().slideToggle();
  26. });​