-1

I am developing cms widgets using lit-element and it contains leaflet maps. we open popups inside the map when we click on the marker. and close them inside the map. But the problem is how to close those opened leaflet marker popups when click outside of the leaflet map ?

. I was looking for the answer for long time. But i couldn't find any. Please help me .. Thanks in advance.

Rishni Meemeduma
  • 324
  • 3
  • 14

1 Answers1

0

documentation stated may use closePopup function to closes the popup previously opened with openPopup. Based on my understanding to the documentation, you may try to store openPopup as a variable, trigger function to close the popup once clicking outside the map.

var boo = L.marker([51.5, -0.09]).addTo(map)
.bindPopup('A pretty CSS3 popup.<br> Easily customizable.')
.openPopup();

L.marker([51.5, -0.09]).closePopup(boo);
J.C. Fong
  • 516
  • 7
  • 15