diff options
| author | 2025-08-18 17:21:32 +0700 | |
|---|---|---|
| committer | 2025-08-18 17:21:32 +0700 | |
| commit | 1a0abbb6439690fb9167dce5ecb800dc5c41e130 (patch) | |
| tree | 52dee20ea40fb3844e2094084c780d2e0f048026 | |
| parent | f089ba2435eb4a54ab4e6b2c20d91d0c9f872a2d (diff) | |
| download | web-1a0abbb6439690fb9167dce5ecb800dc5c41e130.tar.gz web-1a0abbb6439690fb9167dce5ecb800dc5c41e130.zip | |
fix: set thumb width to 10vmin to fix thumb align and shift
| -rw-r--r-- | internal/lightgallery/html_renderer.go | 2 | ||||
| -rw-r--r-- | views/layouts/general-page.html | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/internal/lightgallery/html_renderer.go b/internal/lightgallery/html_renderer.go index 849759e..e20e9ec 100644 --- a/internal/lightgallery/html_renderer.go +++ b/internal/lightgallery/html_renderer.go @@ -106,7 +106,7 @@ function createLightGallery%s() { isMobile: () => false, slideDelay: 0, plugins: [lgZoom, lgThumbnail], - thumbWidth: 160, + thumbWidth: calculateVmin(10), thumbHeight: "10vmin", thumbMargin: 4 }); diff --git a/views/layouts/general-page.html b/views/layouts/general-page.html index 5918956..cd19bd0 100644 --- a/views/layouts/general-page.html +++ b/views/layouts/general-page.html @@ -98,6 +98,17 @@ } }); + function calculateVmin(percent) { + const viewportWidth = window.innerWidth; + const viewportHeight = window.innerHeight; + + const smallerDimension = Math.min(viewportWidth, viewportHeight); + + const vminValue = (smallerDimension / 100) * percent; + + return vminValue; + } + function calculateVmax(percent) { const viewportWidth = window.innerWidth; const viewportHeight = window.innerHeight; |