detect cursor type

前端 未结 4 1109
渐次进展
渐次进展 2021-01-11 16:46

I want JavaScript code to detect the cursor type.

For example when the cursor hovers in textarea it changes from default to text ..

4条回答
  •  既然无缘
    2021-01-11 17:44

    You could do this, but its not pretty, and will probably be quite slow depending on how many elements you have on your page.

    $('*').mouseenter(function(){
        var currentCursor = $(this).css('cursor') ;
    
        //do what you want here, i.e.
        console.log( currentCursor );
    });
    

提交回复
热议问题