简体   繁体   English

导航栏下的Bootstrap Off Canvas菜单

[英]Bootstrap Off Canvas menu under Navigation Bar

Please forgive me if you feel that the question i am asking is little silly. 如果您觉得我要问的问题有点傻,请原谅我。

I am trying to create HTML page with Bootstrap NavBar and Off Canvas and found the page which does exactly the same i wanted. 我正在尝试使用Bootstrap NavBar和Off Canvas创建HTML页面,发现该页面的功能与我想要的完全相同。 On top of the existing i need one extra feature. 在现有的基础上,我需要一项额外的功能。

http://getbootstrap.com/examples/offcanvas/ http://getbootstrap.com/examples/offcanvas/

If you look at this link you will see navigation bar on top of the page and list on right hadn side. 如果您查看此链接,您将在页面顶部看到导航栏,在右侧的避风港上看到列表。 whne we reduce the size of the page navigation bar will turn into Menu icon and list will disappear. 如果我们减小页面导航栏的大小,它将变成菜单图标,列表将消失。 Also new button will be added to show hide list.(see below Big screen image) 此外,还将添加新按钮以显示隐藏列表。(请参见大屏幕图像下方)

What i need is to move the link/button which is visible on small screen should get added on the left side of the navbar. 我需要的是移动在小屏幕上可见的链接/按钮,应将其添加到导航栏的左侧。 Simmiler kind of icon the one we have for menu on small screen.(see below small screen image) Simmiler是一种在小屏幕菜单上显示的图标。(请参见下面的小屏幕图像)

Big screen 大屏幕

在此处输入图片说明

Small screen 小萤幕

在此处输入图片说明

You could put the toggle button into the navbar like this.. 您可以像这样将切换按钮放入导航栏中。

<div class="navbar-header">
       <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
       </button>
       <button type="button" class="navbar-toggle visible-xs pull-left" data-toggle="offcanvas">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
       </button>
       <a class="navbar-brand" href="#">Project name</a>
</div>

Codeply demo Codeply演示

Try using the pull-left class on the button instead of the default pull-right class. 尝试使用按钮上的pull-left类,而不是默认的pull-right类。

Example: http://www.bootply.com/274FaWMbMX 例如: http//www.bootply.com/274FaWMbMX

The flaw with this design is that after a user clicks the button to access the menu, the button is no longer visible due to the menu expanding. 这种设计的缺陷在于,用户单击按钮访问菜单后,由于菜单展开,该按钮不再可见。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM