Created
February 18, 2016 18:57
-
-
Save milosdjakonovic/e2651c60ab24224354cf to your computer and use it in GitHub Desktop.
Console print z-index props from any element
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
/* | |
* 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