Find Highest Z-Index by Tag Name


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function findHighestZIndex(elem) {
  2. var elems = document.getElementsByTagName(elem);
  3. var highest = 0;
  4.  
  5. for (var i = 0; i < elems.length; i++) {
  6. var zindex=document.defaultView.getComputedStyle(elems[i],null).getPropertyValue("z-index");
  7. if ((zindex > highest) && (zindex != 'auto')) {
  8. highest = zindex;
  9. }
  10. }
  11.  
  12. return highest;
  13. }

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.