我想要 JavaScript 代码来检测鼠标光标类型。
例如当光标悬停在<textarea>
它从默认更改为文本。
我将如何检测这个?
最佳答案
你可以这样做,但它并不漂亮,而且可能会很慢,具体取决于页面上有多少元素。
$('*').mouseenter(function(){
var currentCursor = $(this).css('cursor') ;
//do what you want here, i.e.
console.log( currentCursor );
});
关于javascript - 检测鼠标光标类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5304668/