Jquery:隐藏顶部菜单,暂停鼠标移动时向上滑动
I'm creating a header menu that slides down when you move the mouse within in the browser window.
But I want to have it slide up after the mouse hasn't moved for 5 seconds.
Here is what I have so far: http://jsfiddle.net/BEzbw/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
jQuerythrottle/debounce 是一个很棒的插件,可以安全地执行此类操作。 jsFiddle
ps:请记住,附加到
中方式可能会让您的事件被其他页面元素阻止(尽管对于 mousemove 事件来说不太可能)。
jQuery throttle/debounce is a great plugin for doing things like this safely. jsFiddle
ps: bear in mind that attaching to
<html>
in that way could get your event blocked by other page elements (although unlikely for a mousemove event).尝试一下
http://jsfiddle.net/lastrose/BEzbw/3/
可能需要不过要注意时间安排
give this a try
http://jsfiddle.net/lastrose/BEzbw/3/
might need to work on the timing though
像这样的东西吗?
Something like this?