bootstrap: two toggle buttons on the nav bar

Problem: Both menus on the mobile version collapses when the buttons are pressed. You only want one menu to unfold at a time. 

Found a fix here: http://jsfiddle.net/gNUEx/

Modified the code a bit:

  var navbar = $('.navbar');

  navbar.on('click', '[data-toggle="collapse"]', function(event){
   var $target = $($(this).data('target')); 
    if(!$target.hasClass('in'))
      $('.container .in').removeClass('in').height(0);    
    })


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *