I want to make a dropdown menu, so I have a horizontal navigation with
So, I think the best way is to simply show you the code:
<div id="top_navi">
<ul>
<li>
<a href="#" title="Kategorien">Kategorien</a>
<ul id="dropdown_categories" class="dropdown-menu">
<li >
<a href="http://web28.vsrv10.wwggmbh.de/produkttipps" title="Produkttipps" >Produkttipps</a>
</li>
<li >
<a href="http://web28.vsrv10.wwggmbh.de/testkategorie-1" title="Testkategorie 1" >Testkategorie 1</a>
</li>
</ul>
</li>
<li>
<a href="#" title="Hersteller">Hersteller</a>
<ul id="dropdown_categories" class="dropdown-menu">
<li >
<a href="http://web28.vsrv10.wwggmbh.de/produkttipps" title="Produkttipps" >Produkttipps</a>
</li>
<li >
<a href="http://web28.vsrv10.wwggmbh.de/testkategorie-1" title="Testkategorie 1" >Testkategorie 1</a>
</li>
</ul>
</li>
</ul>
</div>
This is the JS Code:
$(document).ready(function() {
$('#top_navi ul li').hover(function() {
$(this).find('.dropdown-menu').css('display', 'inline-block');
$(this).find('.dropdown-menu').show();
}, function() {
$(this).find('ul').hide();
});
});
and the css code:
#top_navi {
height: 25px;
background-color: #8E8777;
}
#top_navi ul {
text-align: center;
padding-top: 7px;
height: 18px;
}
#top_navi li {
position: relative;
display: inline;
text-transform: uppercase;
font-size: 1.3em;
font-weight: 100;
padding: 3px 7px 1px 7px;
color: #dfdbd5;
text-decoration: none;
}
#top_navi li a {
color: inherit;
text-decoration: none;
}
#top_navi li:hover {
background-color: #dfdbd5;
color: #8E8777;
}
/* Dropdown menu */
.dropdown-menu {
width: auto;
height: 100%;
position: absolute;
top: 22px;
z-index: 10;
background-color: #dfdbd5;
display: none;
padding-top: 0 !important;
margin-top: 2px !important;
}
.dropdown-menu li {
display: block !important;
min-width: 150px;
font-size: 0.8em !important;
text-transform: none !important;
color: #8E8777 !important;
text-align: left !important;
padding: 5px 0;
background-color: #dfdbd5;
border-left: 1px solid #000;
border-right: 1px solid #000;
}
.dropdown-menu li:last-child {
border-bottom: 1px solid #000;
}
.dropdown-menu li:hover {
background-color: #8E8777 !important;
color: #dfdbd5 !important;
}
I also made a screenshot for better understanding:

I have no idea how to solve the problem, but just in case you don´t get along at all, I developed a small “simulation” of your markup that only relies on divs:
Html:
CSS:
jQuery: (sorry, it´s a little wrong, just for demonstration)