我有一個v3谷歌地圖加載完全符合我的預期和標記做我想要的。但是,當我更改縮放時,我添加的zoom_changed事件似乎不會觸發。任何人都可以解釋爲什麼?我的代碼如下。谷歌地圖v3 zoom_changed事件不會觸發當變焦變化
function map_initialise() {
var mapCentre = new google.maps.LatLng(53.75, -1.50);
var mapOptions = {
zoom: 6,
center: mapCentre,
mapTypeId: google.maps.MapTypeId.HYBRID
}
var map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
var latlong1 = new google.maps.LatLng(52.456550,1.680182);
var windowtext1 = 'Some text';
var popup1 = new google.maps.InfoWindow({
content: windowtext1
});
var marker1 = new google.maps.Marker({
position: latlong1,
title: "Some text"
});
google.maps.event.addListener(marker1, 'click', function() {
popup1.open(map,marker1);
});
marker1.setMap(map);
}
google.maps.event.addDomListener(window, 'load', map_initialise);
google.maps.event.addListener(map, 'zoom_changed', function() {
setTimeout(reCentre, 3000);
});
function reCentre() {
var newcentre = new google.maps.LatLng(53.000,0.000);
map.panTo(newcentre);
}
謝謝,蓋倫。隨着這些細微的變化,事件現在正在發射。 – Jason 2010-11-01 09:07:18
謝謝..很好的回答......................... – 2014-07-09 12:51:34