[英]Getting rid of scroll bars in drop down menu in mobile
Hi I am trying to figure out how to get the scroll bars to not show on the drop down menu that shows up on this page when in mobile view. 嗨,我正在尝试弄清楚如何使滚动条在移动视图中不显示在此页面上显示的下拉菜单上。
[It is asking me for more details before I post and I don't have any except to say that I added some some javascript to this page and jQuery but removed it and had the same problem so I do not think that is it] [它在发布之前要求我提供更多详细信息,我只能说我在此页面和jQuery中添加了一些JavaScript,但是删除了它并遇到了同样的问题,所以我认为不是。]
Mobile Nav CASS 移动导航CASS
#nav_desktop{
display: none;
}
#nav_mobile{
display: block;
}
#nav_mobile ul
{
list-style:none;
position:relative;
float:left;
margin:0;
padding:0;
}
#nav_mobile ul a
{
display:block;
background-color: #4A4949;
color:#ffffff;
text-decoration:none;
font-size: 18px;
padding:0 15px;
font-family: 'Handlee', cursive;
}
#nav_mobile ul a:hover{
color:#f09000;
}
#nav_mobile ul li
{
position:relative;
float:left;
margin:0;
padding:0;
}
#nav_mobile ul li.current-menu-item
{
background:#ddd;
}
#nav_mobile ul ul
{
display:none;
position:absolute;
top:100%;
left:0;
background:#fff;
padding:0;
}
#nav_mobile ul ul li
{
float:none;
width:200px;
}
#nav_mobile ul ul a
{
line-height:75%;
padding:10px 15px;
}
#nav_mobile ul li:hover > ul
{
display:block;
}
Nav HTML 导航HTML
<nav id="nav_desktop">
<ul>
<li><a href="template_test.html">Home</a></li>
<li><a href="#dt">Downtown Tour</a></li>
<li><a href="#gt">Growth Tour</a></li>
<li><a href="#lt">Landmarks Tour</a></li>
<li><a href="#ct">Contact</a></li>
</ul>
</nav>
<nav id="nav_mobile">
<ul>
<li><a href="#">Menu</a>
<ul>
<li><a href="template_test.html">Home</a></li>
<li><a href="#dt">Downtown Tour</a></li>
<li><a href="#gt">Growth Tour</a></li>
<li><a href="#lt">Landmarks Tour</a></li>
<li><a href="#ct">Contact</a></li>
</ul>
</ul>
</nav>
You need to make some changes in your classes like as below - 您需要对课程进行一些更改,如下所示-
#nav_mobile ul ul {
background: #fff none repeat scroll 0 0;
display: none;
left: 0;
padding: 0;
position: absolute;
top: 24px; <!-- change this to 24px -->
}
#nav_mobile ul li {
float: left;
margin: 0;
padding: 0;
<!-- position: relative; (remove it) -->
}
#nav_mobile ul {
float: none;
list-style: outside none none;
margin: 0;
padding: 0;
<!-- position: relative; (remove it) -->
}
you have to give the ul element a display attribute and do not let it float: 您必须给ul元素一个display属性,并且不要让它浮动:
#nav_mobile ul{
float:none;
display:inline;
}
now you should see the whole menu! 现在您应该看到整个菜单!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.