简体   繁体   English

下拉菜单不遵守李父

[英]Drop Down Menu not sticking to LI Parent

I have a drop down menu that looks great when the page it scrolled to the very top, but when I scroll down, the second <li> parent's drop down scrolls up with the page instead of sticking with the parent element. 我有一个下拉菜单,当页面滚动到最顶部时,它看起来很棒,但是当我向下滚动时,第二个<li>父级下拉菜单随页面向上滚动,而不是与父元素保持一致。

RESOLVED: Second drop menu wasn't inside the parent header div. 解决:第二个下拉菜单不在父标题div中。

The top link CREATE works fine, but the link MANAGE is the <li> parent with the problem. 顶部链接CREATE可以正常工作,但是链接MANAGE是出现问题的<li>父级。

Here is the link to the JS: http://www.brandonrray.com/Heriyah/admin/system/js/chrome.js 这是JS的链接: http : //www.brandonrray.com/Heriyah/admin/system/js/chrome.js

Here is the CSS: 这是CSS:

ul {
padding: 0;
margin: 0;
}
ul li {
padding: 0;
margin: 0;
}
.chromestyle{
width: 99%;
font-weight: bold;
cursor:pointer;
}
.chromestyle:after{ /*Add margin between menu and rest of content in Firefox*/
content: "."; 
display: block; 
height: 0; 
clear: both; 
visibility: hidden;
}
.chromestyle ul{
width: 100%;
margin: 0;
text-align: right;
}
.chromestyle ul li{
display: inline;
}
.chromestyle ul li a{
color: #494949;
padding-left:15px;
padding-right:15px;
padding-top:20px;
padding-bottom:20px;
margin: 0;
text-decoration: none;
font-family:Arial, Helvetica, sans-serif;
font-size:14px;
color:#FFFFFF;
}
.chromestyle ul li a:hover, .chromestyle ul li a.selected{
background-color:#0abbe1;
}
/* ######### Style for Drop Down Menu ######### */
.dropmenudiv{
cursor:pointer;
position:absolute;
top: 0;
border: 1px solid #BBB; /*THEME CHANGE HERE*/
border-bottom-width: 0;
font:normal 12px Verdana;
line-height:24px;
z-index:100;
background-color: white;
width: 200px;
visibility: hidden;
}
.dropmenudiv a{
width: auto;
display: block;
text-indent: 3px;
border-bottom: 1px solid #BBB; /*THEME CHANGE HERE*/
padding: 2px 0;
text-decoration: none;
font-weight: bold;
color: black;
padding-left:15px;
}
* html .dropmenudiv a{ /*IE only hack*/
width: 100%;
}
.dropmenudiv a:hover{ /*THEME CHANGE HERE*/
background-color: #0abbe1; color:#FFFFFF
}

Why isn't dropmenu2 under the same parent as dropmenu1? 为什么dropmenu2与dropmenu1不在同一父级下? Only dropmenu1 is a child of the heriyah_header div. 只有dropmenu1是heriyah_header div的子级。

If you look closely at the html source you'll find that dropmenu2 is in the wrong place. 如果仔细查看html源,您会发现dropmenu2放在错误的位置。

This is your code 这是你的代码

<div>
   ...
   <div id="dropmenu1">...</div>
</div>
<div id="dropmenu2">...</div>

Dropmenu 2 should in the same place as dropmenu1 Dropmenu 2应该与dropmenu1位于同一位置

<div>
   ...
   <div id="dropmenu1">...</div>
   <div id="dropmenu2">...</div>
</div>

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

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