From 86a4bdf3ebfde5ff126a4174e5ab0556c548fc73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Col=C3=B3n?= Date: Sun, 8 Mar 2020 21:08:17 -0400 Subject: [PATCH] Make zooming in not be terrible with magnific --- styles/all/template/js/reimg.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/styles/all/template/js/reimg.js b/styles/all/template/js/reimg.js index 34569ca..d03377f 100644 --- a/styles/all/template/js/reimg.js +++ b/styles/all/template/js/reimg.js @@ -288,7 +288,7 @@ function ReIMG(altLabels, settings) { let imageIdentifier = '#ReIMG-Clicked img.ReIMG-Anchor', reimgheight = '', reimgwidth = '', - imgposition = 'fixed', + imgposition = reimg.Settings.zoomMethod === ZoomMethods.Magnific ? 'inherit' : 'fixed', reimgleft = '0px', reimgtop = '0px'; @@ -324,7 +324,10 @@ function ReIMG(altLabels, settings) { 'left': $zoomBtn.data('reimgleft') }); } else { - if ([ZoomMethods.ColorBox, ZoomMethods.Magnific].indexOf(reimg.Settings.zoomMethod) < 0) { + if (reimg.Settings.zoomMethod === ZoomMethods.Magnific) { + reimgtop = $zoomBtn.data('reimgtop'); + reimgleft = $zoomBtn.data('reimgleft'); + } else if ([ZoomMethods.ColorBox, ZoomMethods.Magnific].indexOf(reimg.Settings.zoomMethod) < 0) { //Let's make the image panel a little wider const naturalWidth = $image[0].naturalWidth, screenWidth = $(window).width(); @@ -348,9 +351,9 @@ function ReIMG(altLabels, settings) { $zoomBtn.css({ 'left': newLeft }); + imgposition = 'absolute'; } $zoomImg.addClass('ReIMG-ZoomOut'); - imgposition = 'absolute'; } $image.css({