【发布时间】:2020-11-10 09:26:48
【问题描述】:
我有一个代码,它使用leaflet 将弹出窗口呈现给标记,如下所示。
const lat = e.latlng.lat;
if ($('#lmap').css("cursor") === 'crosshair') {
const note = `<div>popup<div>`;
const newMarker = new L.marker(e.latlng,{draggable:true}).addTo(lmap);
if (!(note === "")) {
newMarker.bindPopup(note, {closeOnClick: false, autoClose: false, closeButton: true}).openPopup();
}
}
这里
closeButton: true
用于在我的弹出窗口中呈现关闭按钮。但问题是当我点击标记时弹出关闭。如何防止在单击标记时关闭弹出窗口,而在单击弹出窗口中的关闭按钮时关闭它。
【问题讨论】:
标签: javascript leaflet