检测网页中的鼠标光标类型更改

los*_*rce 5 html javascript javascript-events

当鼠标光标悬停在不同的页面元素上时,是否有任何事件被触发?

理想情况下这样的事件:

window.onmousecursorchange = function(e) {
    // e would contain information about the cursor
    // eg. e.type could contain 'text','pointer', etc..
}
Run Code Online (Sandbox Code Playgroud)

注意:解决方案不应涉及jQuery或其他库

更新:

"可能重复"的问题用jQuery标记,所有答案(没有一个解决问题)基于jQuery.我正在寻找一个纯JavaScript解决方案.如果主持人认为这还不足以让这个问题保持开放,请随时关闭.

mbh*_*n88 2

是的,有活动onmouseenter

$('*').mouseenter(function(){
    var currentCursor = $(this).css('cursor') ;
    console.log( currentCursor );
});
Run Code Online (Sandbox Code Playgroud)