The new leaflet v1 bring the fadeOut animation when closing popup. It is great, but :
It would be great to have an option to let user choose to have or NOT this fadeOut.
Explaination : I run some functions map.on.popupopen to style in real time the popup wich is opening (different styles for different places on earth). And with the new fadeout now included, the styles I add are already visible during fadeOut of the CLOSING popup (before the new popup is opened). Which leads to an ugly visual mix:)
http://jsfiddle.net/Pe5xU/268/
I think It would be great to let us choose to have/not have fadeIn/fadeOut of popups independently of each other rather than the global option fadeAnimation true/false.
Even without regarding "my" little problem, I love to see the popups disappear without fade and mybe I'm not alone... :)
If you are already styling popups, just add this bit of CSS:
.leaflet-fade-anim .leaflet-popup {
transition: none;
}
let us choose to have/not have fadeIn/fadeOut of popups independently of each other rather than the global option fadeAnimation true/false.
Just add a CSS class to those popups you want to disable fade anims for, and use the same bit of CSS :-)
I don't think this is a very important feature to have, specially when it can be worked around with a bit of extra CSS.
Thanks. But It skip the fadeIn too in the meanwhile...
It's not very important though, you're right.
It can be done by stripping a few lines in the source code (it's bad, I know:).
When removing popup, I skip the IF part to avoid the fadeOut :
L.Popup = L.Layer.extend({ ... onRemove: function (map) { //if (map._fadeAnimated) { // L.DomUtil.setOpacity(this._container, 0); // this._removeTimeout = setTimeout(L.bind(L.DomUtil.remove, L.DomUtil, this._container), 200); //} else { L.DomUtil.remove(this._container); //} map.fire('popupclose', {popup: this}); if (this._source) { this._source.fire('popupclose', {popup: this}, true); } }, ... )}
@remilev Please don't modify the minified version of the source code. No one can understand that.
@IvanSanchez Thanks!
.leaflet-fade-anim .leaflet-popup {
transition: none;
}
This works for me.
Most helpful comment
If you are already styling popups, just add this bit of CSS:
Just add a CSS class to those popups you want to disable fade anims for, and use the same bit of CSS :-)
I don't think this is a very important feature to have, specially when it can be worked around with a bit of extra CSS.