From 34a21ffc854127f709637cc48bb5ca210a2605fc Mon Sep 17 00:00:00 2001 From: "Toerd@480" Date: Thu, 24 Oct 2019 00:40:18 +0200 Subject: [PATCH] Mobile js fix for height of zoom bg --- inc/js/zoom.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/inc/js/zoom.js b/inc/js/zoom.js index 9ba9a63..7b4365e 100644 --- a/inc/js/zoom.js +++ b/inc/js/zoom.js @@ -4,7 +4,7 @@ * images inside their box without touching the rest of the layout. * Author: phga/teord * Date: 2019-10-20 - * Version: 1.1 + * Version: 1.2 */ function zoom(factor, imgName) { let img = document.getElementById(imgName); @@ -15,6 +15,11 @@ function zoom(factor, imgName) { // Fix for firefox, somehow width larger than content (inline-block) magni.style.width = "100%"; magni.style.width = img.width; + // mobile fix (for some browsers) + if (Math.max(document.documentElement.clientWidth, window.innerWidth) < 800) { + magni.style.height = "50%"; + magni.style.height = img.height; + } // setup the padding (bigger zoom canvas) magni.style.padding = offset.y + "px " + offset.x + "px"; // adjust the margin to ged rid of the extra size gained from padding