用于Bootstrap 3的Can Canvas(Slide Over)菜单

时间:2014-12-04 17:06:13

标签: jquery css twitter-bootstrap-3

所以我试图在我的导航中实现非画布菜单。我无法用http://getbootstrap.com/examples/offcanvas/

中给出的代码来解决这个问题

当屏幕宽度低于991像素时,单击菜单(或汉堡包)图标时,顶部链接应显示在垂直列表中。我希望垂直列表滑过内容,以便菜单图标仍然可见。所以不是推动效应。

我所描述的一个很好的例子是" Slide In On Top"此网站上的转换http://tympanus.net/Development/SidebarTransitions/

这是我的导航栏的bootply。 http://www.bootply.com/r8RRCqHo9J

导航

<header class="navbar navbar-inverse navbar-static-top" role="banner">
<div class="container">
<div class="navbar-header">
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".navbar-collapse">
<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="#"><img class="img-responsive" src="http://placehold.it/234x84&text=LOGO" alt="..." style="padding:18px 5px"></a>
</div>
<nav class="collapse navbar-collapse" role="navigation">
<ul class="nav navbar-nav navbar-inverse">

<li class="active">
<a href="#">Home</a>
</li>

<li>
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Link 1</a>
<ul class="dropdown-menu">
<li class="drop-down"><a href="#">Sub-Item 1</a></li>
<li class="drop-down"><a href="#">Sub-Item 2</a></li>
<li class="drop-down"><a href="#">Sub-Item 3</a></li>
<li class="drop-down"><a href="#">Sub-Item 4</a></li>
</ul>
</li>

<li>
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Link 2</a>
<ul class="dropdown-menu">
<li class="drop-down"><a href="#">Sub-Item 1</a></li>
<li class="drop-down"><a href="#">Sub-Item 2</a></li>
</ul>
</li>

<li>
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Link 3</a>
<ul class="dropdown-menu">
<li class="drop-down"><a href="#">Sub-Item 1</a></li>
<li class="drop-down"><a href="#">Sub-Item 2</a></li>
</ul>
</li>

<li>
<a href="#">Link 4</a>
</li>

<li>
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Link 5</a>
<ul class="dropdown-menu">
<li class="drop-down"><a href="#">Sub-Item 1</a></li>
<li class="drop-down"><a href="#">Sub-Item 2</a></li>
<li class="drop-down"><a href="#">Sub-Item 3</a></li>
</ul>
</li>


</ul>
</nav>
</div>
</header>

1 个答案:

答案 0 :(得分:4)

您只需将navbar-static-top导航到navbar-fixed-top并向主体添加填充。 检查这个bootply:http://www.bootply.com/X2s18rcAdN


<强>更新

工作解决方案:http://jsbin.com/yuxesupixu/1/edit?html,css,js

基于Christinahttps://stackoverflow.com/a/20864689/1004312

所做的出色工作