Maximum initial zIndex value for V3 markers for Google Maps

I am creating a Google Maps website with markers placed on a map. Markers overlap several times, so I want to be able to interactively display specific ones on the front marker.

I can use setZIndex () for this. But I need to know the initial max zindex of all tokens. getZIndex () is useless, as it does not seem to return anything unless you already called setZIndex ().

It would be tempting to say that โ€œjust start with a very large numberโ€, but I believe that Google uses latitude or something to calculate the initial zIndex, so can the maximum zindex vary? Make this scheme risky.

Does anyone know what the maximum starting zIndex will be for N markers in Google Maps V3?

+8
z-index google-maps-api-3 google-maps-markers
source share
1 answer

You can use the MAX_ZINDEX constant to make sure that the marker will be displayed on top.

marker.setZIndex(google.maps.Marker.MAX_ZINDEX + 1); 

Find the constant link in the Google Maps API V3 Documentation

+18
source share

All Articles