你好,我在网上搜索了很久,但是没有找到答案,所以需要您的帮助。这是我的代码:
for(var i=0; i<10;i++){
LatLon=new google.maps.LatLng(39.633336, 22.386423);
Marker= new google.maps.Marker({position:LatLon,map:MyMap,draggable: true,title:'Mytitle'+i});
MarkersArray[] = Marker; //keep markers in array because i want to delete them later!!!
google.maps.event.addListener(Marker,"dragend",function(event){
var markerNewPosition = this.getPosition();
alert("old position: **here i want to show the old position** \nnew position: "+markerNewPosition);
});
}
到目前为止,当我拖动标记时,会弹出新位置的纬度和经度警报。但我想要更多!我想在拖动结束处理程序中获得标记之前所在位置的坐标以及标记移动到的新位置的坐标。是否有人知道如何做到这一点?任何想法都将不胜感激。提前致谢!