Posted By

iloveitaly on 08/15/09


Tagged

css javascript element name next tag zindex highest


Versions (?)

Find Highest Z-Index by Tag Name


 / Published in: JavaScript
 

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

  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. }

Report this snippet  

You need to login to post a comment.