Created
February 7, 2025 06:32
-
-
Save Alsandre/e370b0f369e2ac7d7c0bbaf7dffe4542 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getNonAutoZIndex(element) { | |
if (!(element instanceof Element)) { | |
console.warn("Invalid element provided."); | |
return null; | |
} | |
const zIndex = window.getComputedStyle(element).zIndex; | |
// Return the z-index value only if it is not 'auto' | |
return zIndex !== 'auto' ? parseInt(zIndex, 10) : null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment