Click link inside Leaflet Popup and do Javascript

前端 未结 7 1814
遇见更好的自我
遇见更好的自我 2020-12-05 06:42

I have a leaflet map up and running. It overlays a series of polygons (via GeoJSON) on the map and attaches popups to each polygon. Each of the popups display information a

7条回答
  •  醉梦人生
    2020-12-05 07:18

    You can check inner properties of popup object, including _wrapper etc.

    map.on('popupopen', _bindPopupClick);
    map.on('popupclose', _unbindPopupClick);
    
    var _bindPopupClick = function (e) {
        if (e.popup) {
            e.popup._wrapper.addEventListener('click', _bindPopupClickHandler);
        }
    };
    var _unbindPopupClick = function (e) {
        if (e.popup) {
            e.popup._wrapper.removeEventListener('click', _bindPopupClickHandler);
        }
    }`
    

提交回复
热议问题