【发布时间】:2016-04-06 13:07:35
【问题描述】:
我正在使用mmenu jquery library 在我的网站上制作移动菜单。我在我的网站中复制粘贴的确切实现代码,并且 mmenu 正在工作,但菜单中的 <li> 行相互堆叠。我相信 mmenu <nav> 的 css 规则从容器 div 中继承了一些 css 规则。当我尝试使用 mmenu 网站上提到的基本示例时,菜单内的这种堆叠行甚至发生了(我的实现提前)。
请帮我解决这个问题。
实际的菜单示例可以找到here
我的实现截图:
<nav id="menu">
<ul>
<li>
<a href="#/">
<i class="fa fa-home"></i>
Home
</a>
</li>
<li>
<a href="#/about">
<i class="fa fa-user"></i>
About us
</a>
</li>
<li>
<a href="#/contact">
<i class="fa fa-envelope"></i>
Contact
</a>
</li>
</ul>
</nav>
jQuery(document).ready(function($) {
$("#menu").mmenu({
extensions: [
"theme-black",
"effect-menu-zoom",
"effect-panels-zoom",
"pagedim-black"
],
navbar: false,
navbars: {
height: 4,
content: [
'<a href="#/" class="fa fa-phone"></a>',
'<img src="http://lorempixel.com/60/60/people/1/" />',
'<a href="#/" class="fa fa-envelope"></a>'
]
}
}).on('click', 'a[href^="#/"]', function() {
alert("Clicked");
return false;
});
});
.mm-menu {
background: #440011 !important;
}
.mm-navbar {
text-align: center;
position: relative;
border-bottom: none;
}
.mm-navbar:before {
content: "";
display: inline-block;
vertical-align: middle;
height: 100%;
width: 1px;
}
.mm-navbar > * {
display: inline-block;
vertical-align: middle;
}
.mm-navbar img {
border: 1px solid rgba(255, 255, 255, 0.6);
border-radius: 60px;
width: 60px;
height: 60px;
padding: 10px;
margin: 0 10px;
}
.mm-navbar a {
border: 1px solid rgba(255, 255, 255, 0.6);
border-radius: 40px;
color: rgba(255, 255, 255, 0.6) !important;
font-size: 16px !important;
line-height: 40px;
width: 40px;
height: 40px;
padding: 0;
}
.mm-navbar a:hover {
border-color: #fff;
color: #fff !important;
}
.mm-listview {
text-transform: uppercase;
font-size: 12px;
}
.mm-listview li:last-child:after {
content: none;
display: none;
}
.mm-listview li:after {
left: 20px !important;
right: 20px !important;
}
.mm-listview a {
text-align: center;
padding: 30px 0 !important;
}
.mm-listview a,
.mm-listview .fa {
color: rgba(255, 255, 255, 0.6);
}
.mm-listview a:hover,
.mm-listview a:hover .fa {
color: #fff;
}
.mm-listview .fa {
position: absolute;
left: 20px;
}
html.mm-opened.mm-effect-zoom-menu body
{
background: #f3f3f3;
}
html.mm-opened.mm-effect-zoom-menu.mm-theme-dark body
{
background: #333;
}
html.mm-opened.mm-effect-zoom-menu.mm-theme-black body
{
background: #000;
}
html.mm-opened.mm-effect-zoom-menu.mm-theme-white body
{
background: #fff;
}
html.mm-opened.mm-effect-zoom-menu .mm-page
{
background-color: #fff;
}
.mm-menu li .fa
{
margin: 0 20px 0 5px;
font-size: 16px;
width: 12px;
}
.mm-menu li[class*="mm-tile"] .fa
{
margin: 0;
line-height: 0;
}
.mm-menu .buttonbar-item:after
{
content: none !important;
display: none !important;
}
【问题讨论】:
标签: javascript jquery html css mmenu