Hi,
I would like to know if there is option to prevent close of popup while clicking another marker, I want to be able to open all of them.
thanks.
https://groups.google.com/forum/#!msg/leaflet-js/qXVBcD3juL4/4pZXHTv1baIJ
https://groups.google.com/forum/#!topic/leaflet-js/b9hkOo7JXso
http://stackoverflow.com/questions/9047931/leaflet-js-open-all-popup-bubbles-on-page-load
google is good.
Best solution I've found, does not require separation of markers and popups onto layers: http://jsfiddle.net/paulovieira/yVLJf/
@gaboom I just ran into a situation where the openPopup implementation changed and it broke my app -- so maybe a less intrusive workaround is desireable ;)
I know this is old, but this is still a problem in RC3.
@catbadger have you read the docs for popup which explain how this can be done?
If you still think this is an issue with Leaflet, you should post some code illustrating the problem.
The docs are out of date. I actually needed to do some overrides to make this happen.
L.Popup = L.Popup.extend({
getEvents: function () {
var events = L.DivOverlay.prototype.getEvents.call(this);
if ('closeOnClick' in this.options ? this.options.closeOnClick : this._map.options.closePopupOnClick) {
//events.preclick = this._close;
}
if (this.options.keepInView) {
events.moveend = this._adjustPan;
}
return events;
},
});
@catbadger that looks a bit complicated.
Setting closePopupOnClick: false in your map options and using map.addLayer as stated in the docs should be enough. See this example: http://playground-leaflet.rhcloud.com/veza/edit?html,output
We should update the docs to include info on closePopupOnClick to make this clearer.
Passing autoClose: false as an option does the trick: http://leafletjs.com/reference-1.0.0.html#popup-autoclose
Most helpful comment
Passing
autoClose: falseas an option does the trick: http://leafletjs.com/reference-1.0.0.html#popup-autoclose