admin管理员组文章数量:1201992
I have a broadcasting video site, with a menu, which should be hidden, when mouse isn't moving for a while (lets say 10 seconds). As well, it should appears back, with mouse move. What is the best way to perform that, by using css and jQuery? Thank you in advance.
I have a broadcasting video site, with a menu, which should be hidden, when mouse isn't moving for a while (lets say 10 seconds). As well, it should appears back, with mouse move. What is the best way to perform that, by using css and jQuery? Thank you in advance.
Share Improve this question edited Nov 30, 2010 at 13:39 karim79 343k67 gold badges417 silver badges407 bronze badges asked Nov 29, 2010 at 16:24 MaayMaay 5751 gold badge9 silver badges28 bronze badges 1- Do you get mouse move events when the mouse moves over the video? Or are you using a plugin which stops all of those events bubbling up? If you can't best to use whatever plugin (I'm assuming Flash) is showing the video to handle the menu too. – Douglas Commented Nov 29, 2010 at 16:40
1 Answer
Reset to default 26Take a look at the mousemove
event. You can try something like this:
var i = null;
$("#element").mousemove(function() {
clearTimeout(i);
$("#menu").show();
i = setTimeout(function () {
$("#menu").hide();
}, 10000);
}).mouseleave(function() {
clearTimeout(i);
$("#menu").hide();
});
Demo: http://jsfiddle.net/AMn9v/6/
本文标签:
版权声明:本文标题:javascript - Hide div element with jQuery, when mouse isn't moving for a period of time? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738568477a2100445.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论