[GIS] Avoiding pre-opened popups in Leaflet

leafletmarkerspopup

I'm using Leaflet to show some info for points:

var m1 = L.marker([20, 90], {icon: picture}).addTo(mymap);
m1.bindPopup('<h1 class="center">Caption</h1> <br><b>Info: </b>bla').openPopup();

How can you avoid that one popup is always opened when opening the HTML document?

Best Answer

Simply remove the call of .openPopup() on your marker:

var m1 = L.marker([20, 90], {icon: picture}).addTo(mymap);
m1.bindPopup('<h1 class="center">Caption</h1> <br><b>Info: </b>bla');