嗨所以我试图抓住dragend事件
map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
google.maps.event.addListener(map,'dragend',function(event) {
//stuff
});
现在奇怪的是,当我使用此事件时,“事件”未定义,但如果我将“dragend”替换为“mouseup”,那么我在我的函数中得到一个已定义的事件。有没有人知道为什么会这样,以及如何获得dragend事件?
答案 0 :(得分:0)
根据the documentation,dragend事件的回调函数没有任何参数:
dragend
参数:无 当用户停止拖动地图时会触发此事件。
拖动结束时你可以在回调中使用其他功能(即map.getCenter()
将获得地图的新中心)