jQuery Find Highest Z-Index on Page
Share
jQuery code snippet find the highest z-index of absolute divs. Useful for making a new element appear absolutely at the top of all html elements.
//include jQuery.js -- visit: http://jquery.com/
$(function(){
var maxZ = Math.max.apply(null,$.map($('body > *'), function(e,n){
if($(e).css('position')=='absolute')
return parseInt($(e).css('z-index'))||1 ;
})
);
alert(maxZ);
});