Bouncy marker in Google Maps v3

假如想象 提交于 2019-12-01 03:08:10

问题


In Google Maps API v2 we can set to marker an option bouncy:true. It adds to marker eye-candy ability - after dragging this marker, it is bouncing.

Is it possible to do in API v3 ?


回答1:


I just had a quick look at the API v3 spec for Markers - it doesn't look like the 'bouncy' option is available right now but I wouldn't be surprised to see this get implemented into the v3 API at some point - it's still in Beta and bound to change quite a bit.

  • Here is a link to the API v3 Reference on the available Marker Options

If you really wanted the behavior in a V3 Map now you could tie an event to the 'dragend' method on the Marker Object. Have the function called alter the anchor point of the MarkerImage object - check out the MarkerImage object in the API too.




回答2:


Here's how you do it in V3

google.maps.event.addListener(marker, "dragend", function(){

   marker.setAnimation(google.maps.Animation.BOUNCE);

});



回答3:


Well, I was looking for a way for implementing bouncy markers in V3 of google maps so that if we are showing a cluster of markers, the currently selected marker should be visible clearly.

We used the z-index property of the marker to set the z-index of the current marker at a relatively higher value than the rest.



来源:https://stackoverflow.com/questions/1847616/bouncy-marker-in-google-maps-v3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!