From d7706d7cb0548ce653411a5617d8d5022a676bf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20Tisza?= Date: Wed, 12 Feb 2014 01:50:56 +0000 Subject: [PATCH] Fix fullscreen bug where image was replaced with self Change-Id: I81dcadae96a778559564a786a5753323fb802b7c --- resources/mmv/mmv.lightboxinterface.js | 6 ++++-- resources/multilightbox/lightboxinterface.js | 8 +++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/resources/mmv/mmv.lightboxinterface.js b/resources/mmv/mmv.lightboxinterface.js index 27ba9ad76..049af76e2 100644 --- a/resources/mmv/mmv.lightboxinterface.js +++ b/resources/mmv/mmv.lightboxinterface.js @@ -156,6 +156,10 @@ }; LIP.replaceImageWith = function ( imageEle ) { + if ( this.$image.is( imageEle ) ) { // http://bugs.jquery.com/ticket/4087 + return; + } + var $image = $( imageEle ); this.currentImage.src = imageEle.src; @@ -178,8 +182,6 @@ return; } - this.viewer.resize( this ); - if ( this.isFullscreen ) { // When entering fullscreen without a mousemove, the browser // still thinks that the cursor is where it was prior to entering diff --git a/resources/multilightbox/lightboxinterface.js b/resources/multilightbox/lightboxinterface.js index da48c4ada..26b0d9843 100644 --- a/resources/multilightbox/lightboxinterface.js +++ b/resources/multilightbox/lightboxinterface.js @@ -85,6 +85,7 @@ if ( this.resizeListener ) { window.removeEventListener( 'resize', this.resizeListener ); + this.resizeListener = null; } }; @@ -167,9 +168,10 @@ // Capture listener so we can remove it later, otherwise // we are going to leak listeners ! - this.resizeListener = function () { iface.resizeCallback(); }; - - window.addEventListener( 'resize', this.resizeListener ); + if ( !this.resizeListener ) { + this.resizeListener = function () { iface.resizeCallback(); }; + window.addEventListener( 'resize', this.resizeListener ); + } lightboxHooks.callAll( 'imageLoaded', this ); };