Google maps api 3 谷歌地图API V3更改标记选项
我可以在我的谷歌地图中创建我的标记,但是当单击标记时,地图会缩放到该位置,我想使标记不可单击 我尝试了下列方法,但没有成功Google maps api 3 谷歌地图API V3更改标记选项,google-maps-api-3,google-maps-markers,Google Maps Api 3,Google Maps Markers,我可以在我的谷歌地图中创建我的标记,但是当单击标记时,地图会缩放到该位置,我想使标记不可单击 我尝试了下列方法,但没有成功 marker = new google.maps.Marker({ icon: image, position: new google.maps.LatLng(locations[i][1], locations[i][2]), flat: true, optimized: false, map: map, visible:
marker = new google.maps.Marker({
icon: image,
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
flat: true,
optimized: false,
map: map,
visible: true,
customInfo: locations[i][0]
});
Read-您要查找的方法的名称称为setOptions
google.maps.event.addListener(marker, 'click', function() {
map.setZoom(17);
map.setCenter(this.getPosition());
marker.MarkerOptions ({
clickable: false
});
});
我发现这其实是一个很简单的方法
marker.setOptions({clickable:false});
marker.setClickable (true);