0
我試圖讓getBounds()
工作。使getBounds()在外部函數中工作
當我有這樣的代碼:
google.maps.event.addListener(map, 'bounds_changed', createMarkerButton(marker,map));
function createMarkerButton(marker,map) {
alert(map.getBounds());
......
}
我得到一個錯誤,說getBounds()
是不確定的。
但是,如果我這樣做
google.maps.event.addListener(map, 'bounds_changed', function(){
alert(map.getBounds());
});
它完美的罰款。但是,我需要在createMarkerButton
函數中工作。我該怎麼做?