jQuery代码段可找到绝对div的最高z索引。 对于使新元素绝对出现在所有html元素的顶部很有用。
//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);
});
From: https://www.sitepoint.com/jquery-find-highest-z-index-page/