[英]Javascript Google Maps API draggable marker click through
当我创建一个不可拖动的标记并单击时,事件是否按预期工作是正常行为。
但是当我设置draggable: true
,draggable效果很好。 但是,当单击标记时,它也会单击并在其下设置另一个制造商。
我有什么想念的吗?
更新:
// marker clicks
function makeDescriptionShower(map, marker, uuid) {
return function() {
console.log("event makeDesccriptionShower");
marker.info.open(map, marker);
//ED
resetForm();
editPOI(uuid, marker);
....
}
}
.....
google.maps.event.addListener(marker, 'click', makeDescriptionShower(map, marker, uuid));
//map clicks
google.maps.event.addListener(map, 'click', function(e) {
console.log("map event");
cleanArrays();
updatingFlag(false);
resetForm();
document.getElementById("latitude").value = e.latLng.lat();
document.getElementById("longitude").value = e.latLng.lng();
placeMarker(e.latLng, map);
});
因为我继续别人的项目。 makeDescriptionShower
内部makeDescriptionShower
错误,以及其他使此点击谷底标记行为的功能。 我通过将崩溃的代码行放入window.onload=function(){
修复所有问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.