Trying to figure out this issue is really testing my patience...I set up a dropdown menu that remains hidden until the user hovers over a list item. However, when hovered over, the list item shifts downward instead of staying in place. This causes the menu to shift further down than intended.
Link to my code: http://codepen.io/anon/pen/PPYKJg
<div id="header">
<nav id="menunav">
<ul id="top-menu">
<li id="topmenu-news" class="toplink"><a href="news.html" target="_blank">news</a></li>
<li id="topmenu-shows" class="toplink"><a href="shows.html" target="_blank">info</a></li>
<li id="topmenu-help" class="toplink"><a href="sorry.html" target="_blank">help</a></li>
<li id="topmenu-rules" class="toplink"><a href="rules.html" target="_blank">rules</a></li>
<li id="topmenu-about" class="toplink"><a href="about.html" target="_blank">about</a></li>
<li id="topmenu-other" class="toplink"><a href="#" target="_blank">»</a>
<ul class="more-menu">
<li id="moremenu-blog" class="morelink"><a href="blog.html" target="_blank">blog</a></li>
<li id="moremenu-stats" class="morelink"><a href="blog.html" target="_blank">stats</a></li>
<li id="moremenu-terms" class="morelink"><a href="tos.html" target="_blank">terms</a></li>
<li id="moremenu-privacy" class="morelink"><a href="privacy.html" target="_blank">privacy policy</a></li>
<li id="moremenu-volunteer" class="morelink"><a href="volunteer.html" target="_blank">volunteer!</a></li>
</ul>
</li>
</ul>
</nav>
</div>
html {
overflow-y: scroll;
}
body {
margin: 45px 0px;
text-align: center;
background: #191919;
}
.header {
color: #FE353D;
}
#top-menu {
background-color:rgba(0,0,0,0.85);
height: 34px;
width: 49.1%;
float: right;
position: relative;
margin-top: 15px;
top: 21px;
left: 88px;
font: bold 20px sans-serif;
border-top-left-radius: 10px;
z-index: 10;
}
#top-menu:hover {
}
.more-menu {
background-color: #111111;
display: none;
position: relative;
top: 16px;
right: 25px;
height: 27px;
width: 475px;
font: bold 14px sans-serif;
outline: 1px solid #000000;
z-index: 11;
}
.toplink {
margin-right: 35px;
}
ul {
text-align: left;
display: inline;
list-style: none;
}
ul li {
display: inline-block;
position: relative;
margin-right: 30px;
padding-top: 5px;
}
ul li a {
color: #FFFFFF;
text-decoration: none;
}
li.option {
margin-left: -30px;
margin-top: -25px;
}
$('#top-menu').hover(
function (){
$('.more-menu').css('display','inline');
},
function (){
$('.more-menu').css('display','none');
}
);
Anyone have any insights into what might be causing this behavior? I'm at my wit's end trying to solve it!