0

As there a way to add a popup to a marker but only show it when it is clicked?

As it seems to be default to show it when one is loaded. This is no good when markers are getting updated.

Currently using this

 mymarker = new L.Marker(e.latlng, {
                icon: yellowIcon,
               draggable: true
             });


             map.addLayer(mymarker);
             mymarker.bindPopup('<p>You are here ' + username + '</p>').openPopup();
4

Just leave out call of .openPopup() method:

mymarker.bindPopup('<p>You are here ' + username + '</p>');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.