繁体   English   中英

在地图上移动时如何更改Google地图的标记大小

[英]How to change google map's marker size when moving it on map

在地图上移动时如何更改Google地图的标记。

当我在地图上移动时,将标记的大小更改为小,而在固定位置时,将其大小更改为大。

谢谢。

当触发事件“ dragstart”和“ dragend”时,您可以尝试执行此操作。

例:

  google.maps.event.addListener(marker, 'dragstart', function(event) {
    //increase size
    marker.setIcon({url : 'path_to_img', scaledSize: {height: 12 , width: 12}})
  });

  google.maps.event.addListener(marker, 'dragend', function(event) {
   //decrease size
   marker.setIcon({url : 'path_to_img', scaledSize: {height: 64 , width: 64}})
  });

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM