2 回答
TA贡献1816条经验 获得超4个赞
你可以通过使用setTimeout函数来实现
set delayMarker = 200; // 你可以在这里设置你的延迟时间
$.ajax({
type: 'get',
url: APP_URL + '/yestoday',
data: {_token:"{{csrf_token()}}"},
success: function (data) {
var locations = Array();
var map = new google.maps.Map(document.getElementById('map'), {
center: new google.maps.LatLng(20.593683,78.962883),
zoom: 7,
});
var delayMarker = 200;
jQuery.each(data , function (index, value){
setTimeout(function() {
var points = Array();
var point = new google.maps.LatLng(parseFloat(value.latitude),parseFloat(value.longitude));
points.push(parseFloat(value.latitude));
points.push(parseFloat(value.longitude));
points.push(value.store_name);
points.push(value.store_address);
locations.push(points);
var marker = new google.maps.Marker({
position: point,
map: map,
animation: google.maps.Animation.DROP,
});
var infowindow = new google.maps.InfoWindow();
google.maps.event.addListener(marker, 'mouseover', function() {
infowindow.setContent('<div><strong>'+points[2]+'</strong><br><strong>'+points[3]+'</strong></div>');
infowindow.open(map, this);
});
google.maps.event.addListener(marker, 'mouseout', function() {
infowindow.close();
});
},index * delayMarker);
});
},
});
- 2 回答
- 0 关注
- 145 浏览
添加回答
举报