From 7e90c7540a91841b5913582b4729ac087d314c10 Mon Sep 17 00:00:00 2001 From: Joseph Kim Date: Thu, 12 Feb 2015 22:52:39 -0800 Subject: [PATCH 1/2] add z-index option to set z-index with modal Add z_index option to set z-index of container. To use elevateZoom with modal, z-index has to be higher then modal container. --- demo_with_modal.html | 37 +++++++++++++++++++++++++++++++++++++ jquery.elevatezoom.js | 7 +++---- 2 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 demo_with_modal.html diff --git a/demo_with_modal.html b/demo_with_modal.html new file mode 100644 index 0000000..853843a --- /dev/null +++ b/demo_with_modal.html @@ -0,0 +1,37 @@ + + + + + jQuery elevateZoom Demo + + + + + + +

Basic Zoom Example

+ + + + + \ No newline at end of file diff --git a/jquery.elevatezoom.js b/jquery.elevatezoom.js index 6d1f3ae..40335e7 100755 --- a/jquery.elevatezoom.js +++ b/jquery.elevatezoom.js @@ -62,8 +62,6 @@ if ( typeof Object.create !== 'function' ) { self.refresh( 1 ); - - //Create the image swap from the gallery $('#'+self.options.gallery + ' a').click( function(e) { @@ -257,7 +255,7 @@ if ( typeof Object.create !== 'function' ) { //create the div's + "" //self.zoomContainer = $('
').addClass('zoomContainer').css({"position":"relative", "height":self.nzHeight, "width":self.nzWidth}); - self.zoomContainer = $('
'); + self.zoomContainer = $('
'); $('body').append(self.zoomContainer); @@ -1771,7 +1769,8 @@ if ( typeof Object.create !== 'function' ) { onComplete: $.noop, onZoomedImageLoaded: function() {}, onImageSwap: $.noop, - onImageSwapComplete: $.noop + onImageSwapComplete: $.noop, + z_index: 999 }; })( jQuery, window, document ); \ No newline at end of file From 091dc85668e3080edb8e399569356e430e67a23b Mon Sep 17 00:00:00 2001 From: Joseph Kim Date: Fri, 13 Feb 2015 23:43:43 -0800 Subject: [PATCH 2/2] with Modal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove “.zoomContainer” when modal is close to avoid bug with hided zoom element. --- demo_with_modal.html | 1 + 1 file changed, 1 insertion(+) diff --git a/demo_with_modal.html b/demo_with_modal.html index 853843a..2826c8c 100644 --- a/demo_with_modal.html +++ b/demo_with_modal.html @@ -28,6 +28,7 @@

Basic Zoom Example

}, onHide: function() { //destroy or remove elevateZoom object here. + $(".zoomContainer").remove(); } }) .modal('show');