[編輯] 所以我用的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氣球,將顯示在光標位置。兩個,檢測鼠標停止代碼工作正常,但我很難看到如何檢測到鼠標已經開始再次移動並隱藏氣球。謝謝...