Return to Snippet

Revision: 16772
at August 15, 2009 09:52 by iloveitaly


Initial Code
function findHighestZIndex(elem) {
	var elems = document.getElementsByTagName(elem);
	var highest = 0;
	
	for (var i = 0; i < elems.length; i++) {
		var zindex=document.defaultView.getComputedStyle(elems[i],null).getPropertyValue("z-index");
		if ((zindex > highest) && (zindex != 'auto')) {
			highest = zindex;
		}
	}
	
	return highest;
}

Initial URL
http://stackoverflow.com/questions/1118198/how-can-you-figure-out-the-highest-z-index-in-your-document

Initial Description

                                

Initial Title
Find Highest Z-Index by Tag Name

Initial Tags
css, javascript

Initial Language
JavaScript