参见英文答案 >
Change bootstrap navbar collapse breakpoint without using LESS16个
我正在使用Twitter引导程序整理一个粗略的导航栏.
我正在使用Twitter引导程序整理一个粗略的导航栏.
有一个断点,设备的宽度将导致导航栏项目折叠并显示一个菜单按钮:
如何更改断点以使导航栏更快崩溃?目前,当它出现在徽标上时,它能够突破到新线路,这看起来并不太好:
我已经尝试了修复详细的here,但它似乎打破了折叠的菜单(之后无法再次展开).
这是html:
<!-- navigation --> <div class="navbar navbar-default navbar-static-top"> <div class="container-fluid"> <div class="navbar-header"> <button class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="#"><img class="ManeEventlogo" src="/img/ManeEventlogoWhite-Sm.png"></a> </div> <div class="collapse navbar-collapse navbar-responsive-collapse"> <ul class="nav navbar-nav navbar-right"> <li> <a href="/index.PHP">HOME</a> </li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">SERVICES <span class="caret"></span></a> <ul class="dropdown-menu" role="menu"> <li><a href="/services/cutting-styling/index.PHP">Cutting & Styling</a></li> <li><a href="/services/coloring/index.PHP">Coloring</a></li> <li><a href="/services/hair-straightening-relaxing/index.PHP">Permanent Hair Straightening & Relaxing</a></li> <li><a href="/services/balmain-hair-extensions/index.PHP">Balmain Hair Extensions</a></li> </ul> <li> <a href="/wedding-day/index.PHP">WEDDING DAY</a> </li> <li> <a href="/expertise-team/index.PHP">THE EXPERTISE TEAM</a> </li> <li> <a href="/photo-gallery/index.PHP">PHOTO GALLERY</a> </li> <li> <a href="/blog/index.PHP">BLOG</a> </li> </ul> </div> </div> </div>
解决方法
你使用的是哪个版本的bootstrap? 3.1?无论如何,我还需要你的CSS来帮助你解决它,但一般来说:
@media (max-width: 1200px) { .navbar-header { float: none; } .navbar-left,.navbar-right { float: none !important; } .navbar-toggle { display: block; } .navbar-collapse { border-top: 1px solid transparent; Box-shadow: inset 0 1px 0 rgba(255,255,0.1); } .navbar-fixed-top { top: 0; border-width: 0 0 1px; } .navbar-collapse.collapse { display: none!important; } .navbar-nav { float: none!important; margin-top: 7.5px; } .navbar-nav>li { float: none; } .navbar-nav>li>a { padding-top: 10px; padding-bottom: 10px; } .collapse.in{ display:block !important; } .navbar-nav .open .dropdown-menu { position: static; float: none; width: auto; margin-top: 0; background-color: transparent; border: 0; -webkit-Box-shadow: none; Box-shadow: none; } }
最大宽度是断点.复制自Bootply(其中包含演示).