Skip to content
Advertisement

How can you figure out the highest z-index in your document?

In order to set a div containing a transparent text image as the highest z-index in my document, I picked the number 10,000 and it solved my problem.

Previously I had guessed with the number 3 but it had no effect.

So, is there a more scientific way of figuring out what z-index is higher than that of all of your other elements?

I tried looking for this metric in Firebug but couldn’t find it.

Advertisement

Answer

You could call findHighestZIndex for a particular element type such as <div> like this:

JavaScript

assuming a findHighestZindex function that is defined like this:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement