1
我需要使用某種進度條或輪子等,因爲我有很多標記,並且需要一些時間來加載所有這些標記。我想使用加載或輪等動畫圖像作爲背景,以地圖畫布來顯示進度.. 我需要測試是否所有的標記已加載..如何做到這一點? 如果我可以這樣做,我可以將地圖背景作爲進度欄圖標,直到所有標記都加載完畢,然後一旦它們全部加載完畢,隱藏進度欄圖標或風扇?這是一個好主意嗎?如何測試所有標記是否已在谷歌地圖中加載?
var geocoder;
var map;
function initialize() {
geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(42.095287, -79.3185139);
var myOptions = {
maxZoom: 14,
zoom: 9,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP,
};
map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
createOverlay();
}
function codeAddress() {
var infowindow = new google.maps.InfoWindow({});
$('.LocationAddress').each(function() {
var addy = $(this).text();
geocoder.geocode({ 'address': addy}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
position: results[0].geometry.location,
map: map,
title:addy,
});
//Adding a click event to the marker
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent('<div id=\"infowindow\" style=" height:100px;>'
+'<div id=\"LeftInfo\">'+ "Hello World!"
+'</div>'+'</div>');
infowindow.open(map, this);
});
}
});//Geocoder END
});
}