0
我正在使用jquery创建一个自定义下拉列表,下面的代码。我已经尝试了几乎工作的jquery超时效果,它的用法就像.idle(500);延迟下拉列表 - settimeout
我在下面的方法,一次下降所有的菜单。与不使用超时和嵌套的ishowmenu功能相比。
关于我能做什么的任何想法?
当使用idle()时,它首先显示div初始高度,然后放弃其余部分,我希望它会在500 ms后显示ALL。
我也试过这个下面,就立即
$(".main-heading").idle(2000).one("mouseover", showMenu);
function showMenu() {
setTimeout(iShowMenu,500);
function iShowMenu(){
$(".openMenu").each(HideMenu); //Hide any open menus
$(this).parent().addClass("openMenu");
if (this.id == "flea-tick-nav") {//If it is out problem one
h = "280px"; //Or what ever the hight needs to be for that tab
}else{
h="200px";
}
$(".sub-drop-old", this.parentNode).show().animate({
height: h
}, 500, "linear", function() {
$(this).parent(".main-menu").one("mouseleave", HideMenu);
});
}
}
function HideMenu() {
$(".sub-drop-old:visible", this).stop().animate({ height: "0px" }, 500, "linear", function() {
$(this).hide().parent(".main-menu").removeClass("openMenu");
$(".main-heading", this.parentNode).one("mouseover", showMenu);
});
}
$(function() {
$(".main-heading").one("mouseover", showMenu);
});
啊,我明白你在做什么。聪明。我喜欢这样,只是动画,并使用完整的来调用它。看看如果你快速浏览它们,它们仍然滑落,想法? http://staging.petfooddirect.com:84/ – Coughlin 2009-10-28 14:46:05
试试这个插件http://cherne.net/brian/resources/jquery.hoverIntent.html – ekhaled 2009-10-28 15:01:53