I need a delay on my dropdownmenu. i tried to use, hoverintent but its not working, cant find my error.
My CSS:
My Dropdown:
<div id="menu" class="menu"><ul><li class="first"><a href=index.php" title="Home" >Home</a></li>
<li><a href="index.php?id=13" title="Verein" >Verein</a><ul><li class="first"><a href="index.php?id=33" title="Vorstand" >Vorstand</a></li>
<li><a href="index.php?id=5" title="Mitglieder" >Mitglieder</a></li>
<li class="last"><a href="index.php?id=6" title="Anfahrt" >Anfahrt</a></li>
</ul></li>
<li><a href="index.php?id=7" title="Kontakt" >Kontakt</a><ul><li class="first"><a href="/content/Anmeldung_OG_Schau_17_06_2012.doc" title="Ortsgruppenschau" >Ortsgruppenschau</a>/li>
</ul></li>
<li><a href="index.php?id=16" title="Hunde" >Hunde</a><ul><li class="first"><a href="index.php?id=10" title="Hundeschule" >Hundeschule</a></li>
<li><a href="index.php?id=9" title="Hundesport" >Hundesport</a></li>
<li class="last"><a href="index.php?id=31" title="Rassen" >Rassen</a><ul><li class="first"><a href="index.php?id=19" title="Riesenschnauzer" >Riesenschnauzer</a></li>
<li><a href="index.php?id=20" title="Schnauzer" >Schnauzer</a></li>
<li><a href="index.php?id=28" title="Zwergschnauzer" >Zwergschnauzer</a></li>
<li><a href="index.php?id=29" title="Deutscher Pinscher" >Deutscher Pinscher</a></li>
<li><a href="index.php?id=30" title="Zwergpinscher" >Zwergpinscher</a></li>
<li class="last"><a href="index.php?id=32" title="Affenpinscher" >Affenpinscher</a></li>
</ul></li>
</ul></li>
<li><a href="index.php?id=25" title="Galerie" >Galerie</a></li>
<li><a href="index.php?id=27" title="Presse" >Presse</a></li>
<li><a href="index.php?id=34" title="Termine" >Termine</a></li>
<li class="active"><a href="index.php?id=35" title="Links" >Links</a></li>
<li class="last"><a href="index.php?id=36" title="Impressum" >Impressum</a></li>
</ul></div></div>
My js call:
$(function(){
var config = {
sensitivity: 3, // number = sensitivity threshold (must be 1 or higher)
interval: 200, // number = milliseconds for onMouseOver polling interval
over: doOpen, // function = onMouseOver callback (REQUIRED)
timeout: 2000, // number = milliseconds delay before onMouseOut
out: doClose // function = onMouseOut callback (REQUIRED)
};
function doOpen() {
$(this).addClass("hover");
$('ul:first',this).css('visibility', 'visible');
}
function doClose() {
$(this).removeClass("hover");
$('ul:first',this).css('visibility', 'hidden');
alert("test");
}
$(".menu ul li").hoverIntent(config);
$(".menu ul li ul li:has(ul)").find("a:first").append(" » ");
});
If i go over the dropdown menu its saying the test, so it finding the function and there is no error in it, but its not working. How can i get that fixed?
Demo: Demo
Three things.
Your CSS is working without the JS. You need to rewrite the
:hoverof the dropdown ul to.hoverOn the demo you have
$(".test ul li")and not$(".menu ul li"). Will not work because ul has class test and is not child of class testdoOpen and doClose must be defined before they are used in conig.