navbar - Continuously populate twitter-bootstrap navigation menu as the width increases. -


i using default twitter bootstrap responsive navbar (working mobile up). want menu continually populated width of navbar expands.

my current navigation (perfect mobile)

[ menu item 1 | menu item 2 | menu item 3 | items ] 

however width expands populate list more menu items.

[ menu item 1 | menu item 2 | menu item 3 | menu item 4 | items ] 

bootstrap has 'hidden' class hide elements based on size, suffixed on end of class. bootstrap gives these classes trigger @ breakpoints: hidden-xs, hidden-sm, hidden-md, hidden-lg.

so in scenario, this:

<ul>     <li>menu item 1</li>     <li>menu item 2</li>     <li>menu item 3</li>     <li>menu item 4</li>     <li class="hidden-xs hidden-sm">item 5</li>     <li class="hidden-xs hidden-sm hidden-md">item 6</li> <ul> 

basically, these classes mean element hidden until falls breakpoint range outside of ones hidden classes cover, in case, md , lg last 2 elements.

alternatively, bootstrap has 'visible' set of classes opposite, in case, put 'hidden' class on whatever want hidden, apply 'visible-[size]-[display property]' class (ex: 'visible-lg-inline' or 'visible-lg-inline-block', in case) display menu items when fall breakpoint ranges.

<ul>     <li>menu item 1</li>     <li>menu item 2</li>     <li>menu item 3</li>     <li>menu item 4</li>     <li class="hidden visible-md-inline visible-lg-inline">menu item 5</li>     <li class="hidden visible-lg-inline">menu item 6</li> <ul> 

this under assumption you're not trying dynamically add content dom based on breakpoints , these menu items exist within html code. otherwise, you'll have use custom javascript/jquery scripts that.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -