当我从第二级下拉触发器鼠标移出时,我遇到了一个下拉菜单的问题。这是我的网页pass:dropotron中的示例代码。
在我的网页上,我使用了一个名为“dropdown”的下拉 javascript 来使其工作。
这是 html 下拉菜单代码:
<ul>
<li><span class="opener">1st Level<b></b></span><ul>
<li><a href="#">Sample</a></li>
<li><a href="#">Sample</a></li>
<li>
<span>2nd Level<b></b></span>
<ul>
<li><a href="#">This level does not</a></li>
<li><a href="#">auto hide when</a></li>
<li><a href="#">mouseout from 2nd level</a></li>
</ul>
</li>
</ul>
这是连接到下拉菜单的css:
#menu {
padding: 0 45px 0 45px;
position: relative;
background: #209D9D url(images/img02.png) repeat-x top left;
margin: 0;
height: 60px;
width: 890px;
text-shadow: 0 2px 2px #007D7D;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
}
#menu ul {
list-style: none;
padding-top: 12px;
left: -42px;
width: 110%;
font-family: Calibri;
font-size: 18px;
position: relative;
text-align: center;
}
#menu ul li {
padding: 5px 15px 5px 15px;
margin-right: 10px;
display: inline-block;
}
#menu ul li a, #menu ul li span {
text-decoration: none;
color: #FFFFFF;
letter-spacing: -1px;
font-size: 1.25em;
}
#menu ul li span b {
display: inline-block;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-top: 7px solid #00eaff;
margin-left: 8px;
position: relative;
top: -1px;
}
#menu ul li.active {
background: #009bec;
border-top: solid 1px #007cbc;
border-radius: 7px;
border-bottom-left-radius: 0px;
border-bottom-right-radius: 0px;
padding-top: 4px;
padding-bottom: 4px;
}
#menu ul li.active span b {
border-top-color: #37cdff;
}
.dropotron {
background: rgba(0,155,236,0.9);
border-bottom: solid 1px #1d7bc1;
text-shadow: 0 1px 1px #007D7D;
list-style: none;
margin-top: -15px;
padding: 15px 10px 15px 10px;
min-width: 200px;
border-radius: 6px;
box-shadow: 0px 4px 4px 0px rgba(0,0,0,0.2);
font-family: Gotham, "Helvetica Neue", Helvetica, sans-serif;
font-size: 20px;
}
.dropotron a, .dropotron span {
color: #FFFFFF;
text-decoration: none;
letter-spacing: -1px;
display: block;
width: 100%;
position: relative;
}
.dropotron span b {
display: inline-block;
border-top: 6px solid transparent;
border-bottom: 6px solid transparent;
border-left: 7px solid #00eaff;
position: absolute;
right: 10px;
top: 7px;
}
.dropotron li:hover span b {
border-left-color: #37cdff;
}
.dropotron li {
padding: 3px 10px 3px 10px;
margin: 7px 0 7px 0;
border-radius: 7px;
}
.dropotron li:hover, .dropotron li.active {
padding-top: 2px;
padding-bottom: 2px;
background: rgba(35,125,205,0.9);
border-top: solid 1px #1e6db2;
border-bottom: solid 1px #2c9cff;
}
.dropotron-level-1 {
border-top-left-radius: 0;
border-top-right-radius: 0;
}