google marker
$.each(data,function(n,value) {
latestLoc.push(new google.maps.LatLng(data[n]['latitude'], data[n]['longitude']));
beachMarker.push(new CustomMarker(latestLoc[n],map,data[n].user.avatar));
var contentString = '<div class="contentString"><h5 class="username">' + data[n].user.username + '</h5><p>当前速度:' + data[n].speed + 'km/h</p><span>更新时间:'+toStrTime(data[n].time)+'</span></div>';
infowindowB.push(new google.maps.InfoWindow({
position: latestLoc[n],
pixelOffset:new google.maps.Size(0, -45),
content: contentString
}));
google.maps.event.addListener(beachMarker[n], 'click', function() {
infowindowB[n].open(beachMarker[n].get('map'), beachMarker[n]);
});
});
//google add marker
// latestLoc.push(new google.maps.LatLng(data[0]['latitude'], data[0]['longitude']));
// var contentString = '<div class="contentString"><h5 class="username">' + data[n].user.username + '</h5><p>当前速度:' + data[n].speed + 'km/h</p><span>更新时间:'+toStrTime(data[n].time)+'</span></div>';
// beachMarker.push(new google.maps.Marker({
// position: latestLoc[0],
// animation: google.maps.Animation.DROP,
// map: map,
// title: 'tgb',
// icon: markerimg[0]
// }));
// infowindowB.push(new google.maps.InfoWindow({
// position: latestLoc[0],
// content: contentString
// }));
// google.maps.event.addListener(beachMarker[0], 'click', function() {
// infowindowB[0].open(beachMarker[0].get('map'), beachMarker[0]);
// });