From b18c1ae88662ae9eecf6c512c9c63a4c9a8670c9 Mon Sep 17 00:00:00 2001 From: Leonard Jonathan Oh Date: Wed, 29 Dec 2021 01:54:52 +0000 Subject: [PATCH] Fix (gallery): Fix performance issue in stretchx and stretchy --- webize | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/webize b/webize index 0784ec0..573d016 100755 --- a/webize +++ b/webize @@ -463,8 +463,9 @@ cat - >> "$INDEX_HTM" <<'EOF' }; var stretchx = function() { + const viewportWidth = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0); for (var i = 0; i < images.length; i++) { - images[i].parentNode.style.display = "inline-block"; + images[i].parentNode.style.display = "block"; images[i].parentNode.style.width = "100vw"; images[i].parentNode.style.height = "auto"; images[i].style.width = "100%"; @@ -474,8 +475,9 @@ cat - >> "$INDEX_HTM" <<'EOF' }; var stretchy = function() { + const viewportHeight = Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0); for (var i = 0; i < images.length; i++) { - images[i].parentNode.style.display = "inline-block"; + images[i].parentNode.style.display = "block"; images[i].parentNode.style.width = "100vw"; images[i].parentNode.style.height = "100vh"; images[i].style.width = "auto";