Skip to content

Instantly share code, notes, and snippets.

@milosdjakonovic
Created February 18, 2016 18:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milosdjakonovic/e2651c60ab24224354cf to your computer and use it in GitHub Desktop.
Save milosdjakonovic/e2651c60ab24224354cf to your computer and use it in GitHub Desktop.
Console print z-index props from any element
/*
* Find out what is that damn element with highest z-index,
* or simply get the z-index 'picture' of DOM
*
* USAGE: simply paste this in console, hit enter
*/
var all = document.getElementsByTagName('*'),
allLength = all.length;
for(var i=0; i<allLength;i++){
var zIndex = getComputedStyle( all[i] ).zIndex;
if(zIndex !== 'auto' /* you can add here your own additional conditions, like zIndex > 0...*/ ) console.log(zIndex, all[i])
}
// one line version:
for(var all=document.getElementsByTagName("*"),allLength=all.length,i=0;allLength>i;i++){var zIndex=getComputedStyle(all[i]).zIndex;"auto"!==zIndex&&console.log(zIndex,all[i])}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment