[编辑] 所以我用的JavaScript工具提示之一以下建议。如果你移动,我会得到提示,告诉你什么时候停下来,如何隐藏。唯一的问题是它的工作原理当我这样做:如何显示工具提示金球奖当鼠标停止
document.onmousemove = (function() {
var onmousestop = function() {
Tip('Click to search here');
document.getElementById('MyDiv').onmousemove = function() {
UnTip();
};
}, thread;
return function() {
clearTimeout(thread);
thread = setTimeout(onmousestop, 1500);
};
})();
但我要的功能只适用于特定的DIV,如果我改变的第一行“的document.getElementById(‘MyDiv’)的OnMouseMove = (函数(){”我得到一个JavaScript错误的document.getElementById( 'MyDiv')为空我缺少什么....?
[/编辑]
我想显示一个气球风格当用户鼠标停止在一个元素上的时间超过1.5秒,然后如果他们移动鼠标我想隐藏气球我试图使用一些JavaScript代码,我发现在第狂野。下面是我用来检测鼠标何时停止的代码:
document.onmousemove = (function() {
var onmousestop = function() {
//code to show the ballon
};
}, thread;
return function() {
clearTimeout(thread);
thread = setTimeout(onmousestop, 1500);
};
})();
所以我有两个问题。一,没有人有推荐的轻量级的JavaScript气球,将显示在光标位置。两个,检测鼠标停止代码工作正常,但我很难看到如何检测到鼠标已经开始再次移动并隐藏气球。谢谢...