hide - Javascript toggle click off -
i working on adding several expanding divs page, running trouble getting divs automatically collapse when expands. here script working with:
$(document).ready(function() { $('.nav-toggle').click(function(){ var collapse_content_selector = $(this).attr('href'); var toggle_switch = $(this); $(collapse_content_selector).toggle(function(){ if($(this).css('display')=='none'){ } }); }); });
try this:
$(document).ready(function() { $('.nav-toggle').click(function() { var selected = $($(this).attr('href')); $(".tab").not(selected).hide(); selected.toggle(); }); });
replace .tab
class use expandable divs.
Comments
Post a Comment