0
我已经遍布网络,但仍然可以得到这个权利。 我使用jQuery代码是:如何使用mousemove显示div,然后在2秒后自动隐藏它们
$(document).ready(function(){
// Slide top and bottom bars away in all screens except the lobby
$("#main_content").ajaxStop(function(){
if($("#content_text").length){
}
else{
$("#top").slideUp(2000);
$("#btm").slideUp(2000);
}
});
// Slide bars back in when the mouse is moved and then away again after 2 seconds
var fadeout = null;
$("html").mousemove(function() {
$("#top").slideDown(2000);
$("#btm").slideDown(2000);
if (fadeout != null) {
clearTimeout(fadeout);
}
fadeout = setTimeout(3000, hide_playerlist);
alert("call back fired");
});
function hide_playlist() {
$("#top").slideUp(2000);
$("#btm").slideUp(2000);
}
});
问题是缪斯的举动过于敏感而触发每个像素运动之后。有没有办法做到这一点?
你能否提供在[的jsfiddle]一个活生生的例子工作(http://jsfiddle.net/)? –
你的'setTimeout'正在调用一个未定义的函数:'hide_playerlist'而不是'hide_playlist' – tomaroo
感谢您的帮助,但我解决了问题 – user1736482