javascriptgoogle-maps-api-3mapsz-indexgoogle-maps-markers

How do I set the z-index of a marker in Google Maps API v3


Can anyone explain the exact syntax used to set the z-index for a marker using the Google Maps API (Version 3)?


Solution

  • In the MarkerOptions:

    var marker = new google.maps.Marker({ 
        ....
        zIndex: 100 
    });
    

    Or via the Marker setter:

    marker.setZIndex(100);