[英]Overlay Menu (jQuery/CSS)
I'm currently working on a site which is optimized for mobile and stationary devices. 我目前正在针对移动和固定设备进行了优化的网站上工作。 currently I'm thinking of the main navigation which should work like an overlay which slides down, just like http://www.teehanlax.com/ .
目前,我正在考虑主导航,该主导航应像向下滑动的覆盖层一样工作,就像http://www.teehanlax.com/一样。
but i have no idea how to make that overlay effect. 但我不知道如何使叠加效果。 only thing I'm getting done, is that the part of the page slides down when the menu button is clicked.
我唯一要做的就是单击菜单按钮时页面的一部分向下滑动。 but this is no real overlay effect.
但这不是真正的叠加效果。
syntax of the menu: 菜单语法:
<div id="navContainer">
<div id="topNav">
<div class="top">
<div class="heading">
<div id="logo">LOGO</div>
</div>
<a href="#" class="menu">MENU</a>
</div>
</div>
</div>
<div class="drawer">
<nav>
<ul class="nav nav-tabs nav-stacked">
<li><a href="#">Menu Item</a></li>
<li><a href="#">Menu Item</a></li>
<li><a href="#">Menu Item</a></li>
<li><a href="#">Menu Item</a></li>
<li><a href="#">Menu Item</a></li>
</ul>
</nav>
</div>
the menu works much like that http://jsfiddle.net/RFpDJ/1/ but it should overlay the content and not push it down. 菜单的工作原理与http://jsfiddle.net/RFpDJ/1/相似,但它应该覆盖内容而不是将其下推。
Any ideas? 有任何想法吗?
If you want to remove the menu from normal layout flow, you can simply give it position: absolute;
如果要从常规布局流程中删除菜单,则只需为其指定
position: absolute;
.drawer {
position: absolute;
width: 100%;
}
http://jsfiddle.net/RFpDJ/12/ http://jsfiddle.net/RFpDJ/12/
I also moved the content outside of .drawer
because you don't want that pushed down as well as the menu. 我也将内容移到
.drawer
之外,因为您不希望将内容以及菜单下移。 (Also tweaked some other values, but they are largely irrelevant.) (还调整了其他一些值,但它们基本上无关紧要。)
check this: 检查一下:
.drawer {
position: absolute;
width:100%;
top:-100px;
}
.content{
top:90px;
position:absolute;
width:100%;
height:400px;
}
working here: http://jsfiddle.net/RFpDJ/14/ 在这里工作: http : //jsfiddle.net/RFpDJ/14/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.