Mobile js fix for height of zoom bg

master
Toerd@480 5 years ago
parent 287f91420f
commit 34a21ffc85

@ -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

Loading…
Cancel
Save