简体   繁体   English

在我可以访问链接之前,下拉菜单消失了

[英]Drop down menu disappearing before I can get to the links

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. 继续编辑这个fadesettings: {overduration: 350, outduration: 2000}在js中只改变动画速度。 But THAT IS NOT what I want =). 但那不是我想要的=)。

Please check this JSFiddle to see the JS, CSS, and HTML. 请检查此JSFiddle以查看JS,CSS和HTML。

Thanks for the help guys 谢谢你的帮助

PS:- 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. PS: - 关于顶部:你看到80px的差距,我故意把它放在那里,因为我正在设计我的网站,所以我想要那里的差距。

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/ http://jsfiddle.net/KB5Ve/

EDIT : Added comments on the fiddle : http://jsfiddle.net/DBvq7/ 编辑:添加评论小提琴: http//jsfiddle.net/DBvq7/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM