Skip to content

Instantly share code, notes, and snippets.

@FlameWolf
Created September 22, 2022 06:53
Show Gist options
  • Save FlameWolf/c743b1f24c6f3c58cf21caa16aae3604 to your computer and use it in GitHub Desktop.
Save FlameWolf/c743b1f24c6f3c58cf21caa16aae3604 to your computer and use it in GitHub Desktop.
Find the largest z-index in the document
const getMaxZIndex = function () {
const elements = [...document.querySelectorAll("body *")];
return Math.max(...elements.map(x => parseInt(getComputedStyle(x, null).zIndex) || 0));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment