How can I possibly delay the disappearance of the menu by some miliseconds/seconds? going ahead and editing this fadesettings: {overduration: 350, outduration: 2000}
in the js only changes the animation speed. But THAT IS NOT what I want =).
我怎么可能将菜单的消失延迟几毫秒/秒?继续编辑这个fadesettings:{overduration:350,outduration:2000}在js中只改变动画速度。但那不是我想要的=)。
Please check this JSFiddle to see the JS, CSS, and HTML.
请检查此JSFiddle以查看JS,CSS和HTML。
Thanks for the help guys
谢谢你的帮助
P.S:- about the top:80px gap that you see, I intentionally put it there cuz that's the way I'm styling my site so I want the gap there.
P.S:关于顶部:你看到80px的差距,我故意把它放在那里,因为我正在设计我的网站,所以我想要那里的差距。
1 个解决方案
#1
2
You can user the setTimeout function to add a delay before you call a function.
您可以使用setTimeout函数在调用函数之前添加延迟。
In your case, if you want to delay the fadeout of the menu, instead of just doing :
在你的情况下,如果你想延迟菜单的淡出,而不是只做:
$this.children("ul:eq(0)").fadeOut(jquerycssmenu.fadesettings.outduration);
You could do
你可以做到
setTimeout(function() { $this.children("ul:eq(0)").fadeOut(jquerycssmenu.fadesettings.outduration)
}, 2000);
to delay the call by 2 seconds.
将通话延迟2秒。
Note that I cached the $(this) selector in your fiddle to still be able to access the variable.
请注意,我在你的小提琴中缓存$(this)选择器仍然能够访问变量。
http://jsfiddle.net/KB5Ve/
EDIT : Added comments on the fiddle : http://jsfiddle.net/DBvq7/
编辑:添加评论小提琴:http://jsfiddle.net/DBvq7/
#1
2
You can user the setTimeout function to add a delay before you call a function.
您可以使用setTimeout函数在调用函数之前添加延迟。
In your case, if you want to delay the fadeout of the menu, instead of just doing :
在你的情况下,如果你想延迟菜单的淡出,而不是只做:
$this.children("ul:eq(0)").fadeOut(jquerycssmenu.fadesettings.outduration);
You could do
你可以做到
setTimeout(function() { $this.children("ul:eq(0)").fadeOut(jquerycssmenu.fadesettings.outduration)
}, 2000);
to delay the call by 2 seconds.
将通话延迟2秒。
Note that I cached the $(this) selector in your fiddle to still be able to access the variable.
请注意,我在你的小提琴中缓存$(this)选择器仍然能够访问变量。
http://jsfiddle.net/KB5Ve/
EDIT : Added comments on the fiddle : http://jsfiddle.net/DBvq7/
编辑:添加评论小提琴:http://jsfiddle.net/DBvq7/