开发者

Google maps js api v3: add delay to markers

function setMarkers(map, markers) {

var bounds = new google.maps.LatLngBounds();

for (var i = 0; i < markers.length; i++) { 

    var siteLatLng = new google.maps.LatLng(markers[i][2], markers[i][3]);

    var marker = new google.maps.Marker({
        position: siteLatLng,
        map: map,
        animation: google.maps.Animation.DROP,
        title: markers[i][1],
        html: markers[i][0]
    }); 


    google.maps.event.addListener(marker, "click", function () {
        $('.imglink').attr('href', 'img/' + this.html);
        $('.imglink').click();开发者_如何转开发
    });

    bounds.extend(siteLatLng);
    map.fitBounds(bounds);

} 

}

Is there any way to make a delay between each marker? Thanks


You can set a timeout between the creation of one marker and the next like so (the example below makes a 500ms pause):

setTimeout(function(){}, '500');
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜