How to trigger events on Leaflet map polygons?

后端 未结 3 998
醉酒成梦
醉酒成梦 2021-02-01 20:03

I\'m trying to figure out how to manually trigger events for Leaflet polygons (loaded via GeoJSON).

In a nutshell, I have a Leaflet map with numerous polygons. I also ha

3条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-01 20:53

    function clickMarker(i){
    var popupContent = "content here or html format",
    popup = new L.Popup({offset:new L.Point(0,-28)});
    
    popup.setLatLng(LatLng);
    popup.setContent(popupContent);
    map.panTo(LatLng);
    map.openPopup(popup); }
    

    i = got a corresponding coordinate which is LatLng

提交回复
热议问题