Bootstrap slave tuning memory has a fixed height at the first collapse

This problem can be shown in all versions of Twitter Bootstrap (what I know). So, I have a navbar, and when the screen is smaller, it becomes a resettable tray. This behavior can be seen on the bootstrap demo site. I also have submenus that seemed to crash during the initial navbar extension. The problem is that at the first smoothing the reset gets an explicit height value. If you close and expand again, the minimizer gets height:auto;

So, when I click on a submenu item, the drop-down menu expands, but it overflows because the height is explicitly set.

In my attempt it was added:

 $(function() { $('.nav-collapse').on({ shown: function() { $(this).css('height', 'auto'); }, hidden: function() { $(this).css('height', '0px'); } }); }); 

This does not affect it at all, I deleted this code and it still has the same effect. If JS Fiddle helped, I would be happy to provide it, but you can see all this on the Bootstrap demo site.

Thanks in advance, Charles.

+7
source share
2 answers

This bothered me a bit, and after some searching, I found that the problem can be solved by adding the .collapse class to the .nav-collapse element.

Working demo (jsfiddle)

One of those cases when we just say Fur .. I had to follow the document to the letter (see Responsive navbar ):

 <div class="nav-collapse collapse"> <!-- .nav, .navbar-search, .navbar-form, etc --> </div> 

For posterity:

Detected due to this issue: https://github.com/twitter/bootstrap/issues/3788

I'm not sure if this is really related, but my debugging showed a problem when I first reloaded the transition height ( source ):

 $.support.transition && this.$element[dimension](this.$element[0][scroll]) 
+21
source

Bootstrap sets the style height of the 280px element when initializing the collapse element.

I added this jQuery line to my ready () function right after my call to .collapse ()

 $("#avail_detail").collapse(); $("#avail_detail").css("height","auto"); 

And now everything looks the way I expect.

0
source

All Articles