smeijer / leaflet-geosearch

A geocoding/address-lookup library supporting various api providers.
https://smeijer.github.io/leaflet-geosearch/
MIT License
1.02k stars 270 forks source link

Adding an event listener to the popup #312

Open JStyle21 opened 2 years ago

JStyle21 commented 2 years ago

Hi,

I'm trying to make geosearch work with a custom marker\popup click event, i have leaflet working fine with my marker and event listener but i can't seem to figure out how to reuse the same with geosearch, even if i use popupFormat i can't add an event listener to the marker and even if it's runs the right css code the second time i click the marker it just shows an empty leaflet popup instead of running popupFormat so i'm confused and out of ideas here.

Please suggest if this is possible.

smeijer commented 2 years ago

I think you should configure leaflet-gesearch to not add a marker with showMarker: false, and then listen to the geosearch/showlocation event to handle your own marker logic.