Specify the z-index of Google Map Markers

前端 未结 4 579
离开以前
离开以前 2020-12-25 11:28

I am having a Google Map with lots of markers added using websockets. I am using custom marker images based on data availability. I want to make sure the newest marker stays

4条回答
  •  Happy的楠姐
    2020-12-25 12:17

    You have to set the marker option "optimized" to false in combination with the zIndex option.

    var marker=new google.maps.Marker({
          position:pin2,
          optimized: false,
          zIndex:99999999
    });
    

    This should solve your problem.

提交回复
热议问题