From: Alexander Ebert Date: Mon, 10 Mar 2014 17:06:39 +0000 (+0100) Subject: Fixed displayed image in ImageViewer on window resize X-Git-Tag: 2.0.4~29^2~2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2bb74999de1101e1f29f57b7ad54f798be491991;p=GitHub%2FWoltLab%2FWCF.git Fixed displayed image in ImageViewer on window resize --- diff --git a/wcfsetup/install/files/js/WCF.ImageViewer.js b/wcfsetup/install/files/js/WCF.ImageViewer.js index a5aac579c7..cbebd7de7f 100644 --- a/wcfsetup/install/files/js/WCF.ImageViewer.js +++ b/wcfsetup/install/files/js/WCF.ImageViewer.js @@ -318,7 +318,7 @@ $.widget('ui.wcfImageViewer', { } } - $(document).on('keydown.' + this._eventNamespace, $.proxy(this._keyDown, this)); + this._bindListener(); this._isOpen = true; @@ -344,7 +344,7 @@ $.widget('ui.wcfImageViewer', { this._timer.stop(); } - $(document).off('keydown.' + this._eventNamespace); + this._unbindListener(); this._isOpen = false; @@ -405,6 +405,22 @@ $.widget('ui.wcfImageViewer', { return true; }, + /** + * Binds event listeners. + */ + _bindListener: function() { + $(document).on('keydown.' + this._eventNamespace, $.proxy(this._keyDown, this)); + $(window).on('resize.' + this._eventNamespace, $.proxy(this._renderImage, this)); + }, + + /** + * Unbinds event listeners. + */ + _unbindListener: function() { + $(document).off('keydown.' + this._eventNamespace); + $(window).off('resize.' + this._eventNamespace); + }, + /** * Closes the slideshow on escape. *