开发者

Google maps and raising marker

I'm writing web app that uses google maps. I've got some points placed to the map as markers. When I drag the marker - it raises - and when I drop it - it falls back down. I want to avoid raising marker. Is there any way to dr开发者_如何学Goag it without raising?


This feature has probably been added since the question was asked but stopping the marker from raising is quite straight forward now.

When creating Marker set its 'raiseOnDrag' property to false. Like so...

marker = new google.maps.Marker ({draggable : true, raiseOnDrag : false});


Since there is no option while creating the marker I guess there is no way.

The only thing, I could imagine would be using the icons (in the reference there is an example). But you have to try, I don't know if selfmade icons are raised or not.


You can use marker.setAnimation() method:

var marker = new google.maps.Marker({...});
google.maps.event.trigger(marker, 'dragstart'); // trigger dragstart to keep marker in the "raised" state"
marker.setAnimation(3); // raise
// later
marker.setAnimation(4); // fall

In Google Maps API there are only two types of animations documented (BOUNCE and DROP), but I have discovered two more:

1: BOUNCE,
2: DROP,
3: raise,
4: fall
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜