How to check if cursor style is supported

How to check with JavaScript whether cursor:none supported?

+4
source share
1 answer

Just create an element, set its property and check if the property is saved.

 function isCursorNoneSupported() { var a = document.createElement("a"); a.style.cursor = "none"; return a.style.cursor === 'none'; } if ( isCursorNoneSupported() ) { alert("cursor:none is supported!"); } else { alert("cursor:none is not supported :("); } 

To check which browsers support cursor:none , see: cursor Browser Compatibility

+10
source

Source: https://habr.com/ru/post/1389822/


All Articles