2009-11-17 56 views
3

當通過設置node.style.cursor ='foo'來選擇項目時,我將動態更改光標。看來我的光標不會改變,直到鼠標移動一個像素。如何在鼠標移動前動態更改光標樣式時更改光標

有沒有辦法告訴瀏覽器立即改變它?

+4

在這裏看到:http://stackoverflow.com/questions/1718415/getting-the-browser-cursor-從等待到自動 - 無需用戶移動 - 這個mous – SLaks 2009-11-17 22:41:51

+0

謝謝。我搜查了但沒有遇到。 – mikelikespie 2009-11-19 00:56:27

回答

0

你可以試試jQuery。或者有動態改變類的玩法。

的CSS將是:

span.auto {cursor:auto} 
span.wait {cursor:wait} 

JavaScript的將是:

$(node).removeClass('auto'); 
$(node).addClass('wait); 
+1

再說一遍,你的代碼會在光標移動之前改變光標嗎? – 2012-10-27 15:32:42