diff --git a/src/layer/Popup.js b/src/layer/Popup.js index 442cd1b68de..b3b5729be4f 100644 --- a/src/layer/Popup.js +++ b/src/layer/Popup.js @@ -39,6 +39,7 @@ L.Popup = L.Class.extend({ map._panes.popupPane.appendChild(this._container); map.on('viewreset', this._updatePosition, this); + map.on('moveend', this._updatePosition, this); if (L.Browser.any3d) { map.on('zoomanim', this._zoomAnimation, this); @@ -72,6 +73,7 @@ L.Popup = L.Class.extend({ map.off({ viewreset: this._updatePosition, + moveend: this._updatePosition, preclick: this._close, zoomanim: this._zoomAnimation }, this); @@ -140,8 +142,6 @@ L.Popup = L.Class.extend({ this._updatePosition(); this._container.style.visibility = ''; - - this._adjustPan(); }, _updateContent: function () { @@ -203,6 +203,8 @@ L.Popup = L.Class.extend({ //Bottom position the popup in case the height of the popup changes (images loading etc) this._container.style.bottom = this._containerBottom + 'px'; this._container.style.left = this._containerLeft + 'px'; + + this._adjustPan(); }, _zoomAnimation: function (opt) {