[英]How do I set the z-index of a marker in Google Maps API v3
任何人都可以解释使用Google Maps API(第3版)为标记设置z-index的确切语法吗?
In the MarkerOptions : 在MarkerOptions中 :
var marker = new google.maps.Marker({
....
zIndex: 100
});
Or via the Marker setter: 或者通过Marker setter:
marker.setZIndex(100);
zIndex is actually a relative term. zIndex实际上是一个相对术语。 For example, if you have two markers, marker1 and marker2, and the zIndex of marker1 is 100 and the zIndex of marker2 is 101: it means that marker2 is higher in the stack than marker1. 例如,如果您有两个标记,marker1和marker2,并且marker1的zIndex为100且marker2的zIndex为101:则表示marker2在堆栈中高于marker1。 As a result, marker2 will be on top or marker1, and in front of the user. 因此,marker2将位于顶部或标记1上,并位于用户的前方。
You can set the z-index using : 您可以使用以下命令设置z-index:
var marker=new google.maps.Marker({
position: myCenter,
map: map,
zIndex: 100
});
If you have previously created a marker, then just use: 如果您之前已创建过标记,那么只需使用:
marker.setZIndex(101);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.