Last active
July 4, 2016 03:27
-
-
Save neilgee/d125bc26c7ce906c9854a98f4148a605 to your computer and use it in GitHub Desktop.
Find and Trump Z-Index on all Element on the Page
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
//add in our z-indexstuff | |
var index_highest = 0; | |
// Search all elements with '*' | |
$("*").each(function() { | |
var index_current = parseInt($(this).css("zIndex"), 10); | |
if (index_current > index_highest) { | |
index_highest = index_current; | |
} | |
}); | |
//now the highest number is obtained and captured in the 'index_highest' variable - add 1 to it and assign to your element | |
$('.your-element-to-be-the-highest-z-index').css({ | |
'z-index':index_highest+1 | |
}); | |
//ref - http://stackoverflow.com/questions/5680770/how-to-find-the-highest-z-index-using-jquery |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment