html - Overflowing navbar to a second row using Bootstrap -
html - Overflowing navbar to a second row using Bootstrap -
i'm getting started bootstrap, , doing designed page myself scratch. i'm still stuck on navbar of now.
here's how want work: on desktop/tablets, should work conventional navbars, 1 header element on left , list of alternative on right. on mobile, however, instead of having navbar collapse menu, want - of - move row within navbar.
i tried making class of part want overflow "sidebar", list still renders vertically, collapse menu.
a friend of mine has implemented on site @ "thepickletheory .com" (can't add together direct link lack of reputation), , works there. he's used wordpress theme, however, , code isn't in bootstrap too, can't implement myself either.
here pictures show i'm trying accomplish.
navbar in desktop/tablet view
[name] --- [item 1] [item 2]
navbar in mobile view
[name]
[item 1] [item 2]
here's code navbar i've written far, moves sec part of navbar row, renders list vertically (links dummies now):
<div class="navbar navbar-inverse navbar-static-top"> <div class="container"> <div class="navbar-header"> <a class="navbar-brand" href="#">harshil shah</a> </div> <div class="sidebar"> <ul class="nav navbar-nav navbar-right"> <li><a href="#">about</a></li> <li><a href="#">twitter</a></li> <li><a href="#">blog</a></li> <li><a href="#">archive</a></li> </ul> </div> </div> </div>
would appreciate help getting work. thanks!
edit 2:
through rather fortunate trial-and-error, i've stumbled upon solution: unordered list has assigned .nav-pills
class, , that's takes.
you has specify navbar-collapse
collapse here used enable toggle menu in little screens instead of showing total menu here
<div class="navbar navbar-inverse navbar-static-top"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="#">harshil shah</a> </div> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <div class="sidebar"> <ul class="nav navbar-nav navbar-right"> <li><a href="#">about</a></li> <li><a href="#">twitter</a></li> <li><a href="#">blog</a></li> <li><a href="#">archive</a></li> </ul> </div> </div> </div> </div>
the responsive navbar requires collapse
plugin included in version of bootstrap don't mind binded in bootstrap.js
. here source
instead of collapse can utilize bootstrap grid classes source
<div class="navbar-header col-xs-12 col-md-4"> </div> <div class="col-xs-12 col-md-8"> <!-- here side bar menu --> </div>
which bind accordingly device using. set col size need.
html twitter-bootstrap twitter-bootstrap-3
Comments
Post a Comment