开发者

How to re-drop marker on the google map?

I've got two functions:

function showMarkers() {
    hotspotsIterator = 0;
    for(var i = 0; i < table.length; i++) {
        var obj = table[i];
        if(obj && obj.marker) {
            var obj = table[i];
            obj.marker.setMap(map);
        }
    }
}

function hideMarkers() {
    for(var i = 0; i < table.length; i++) {
        var obj = table[i];
        if(obj && obj.marker) {
            obj.marker.setMap(null);
        }
    }
}

First is showing markers, and second is hiding them. When I first use showMarkers() there is Animation.DROP performed. But when I hide them and show again, animation is not running, and the markers are simply shown.

Can someone tell me how to re-drop markers? Without creating new instances?

EDIT:

I have already created the code to re-create the same marker and it works, but its not elegant solution at all!

An开发者_JAVA百科d Google Docs for markers doesn't resolve the issue.


Add following code right below the obj.marker.setMap(map); : obj.marker.setAnimation(google.maps.Animation.DROP);

Here the reference: Marker Animations

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜