From b6a011121791f516c18e72b1fabdc3ad5c42c552 Mon Sep 17 00:00:00 2001 From: Fabio Date: Sat, 21 Feb 2026 16:50:07 +0100 Subject: [PATCH] 4 --- app.js | 1 + style.css | 58 ++++++++++++++++++++++++++++++++++++------------------- 2 files changed, 39 insertions(+), 20 deletions(-) diff --git a/app.js b/app.js index 5702d3d..1984af9 100644 --- a/app.js +++ b/app.js @@ -117,6 +117,7 @@ function openModal(srcOriginal, srcPreview, photo) { img.src = srcPreview; img.style.maxWidth = "100%"; img.style.maxHeight = "100%"; + img.style.objectFit = "contain"; container.appendChild(img); const full = new Image(); diff --git a/style.css b/style.css index 172de9b..917c350 100644 --- a/style.css +++ b/style.css @@ -24,6 +24,7 @@ header { border-radius: 4px; border: 1px solid #ddd; background: white; + position: relative; } .thumb img { @@ -33,6 +34,22 @@ header { display: block; } +/* Icona play per i video */ +.video-thumb { + position: relative; +} + +.play-icon { + position: absolute; + bottom: 8px; + right: 8px; + background: rgba(0,0,0,0.6); + color: white; + padding: 4px 6px; + border-radius: 4px; + font-size: 14px; +} + /* Modal */ .modal { position: fixed; @@ -48,15 +65,31 @@ header { display: flex; } +/* 🔥 FIX IMPORTANTE: il modal ha dimensione fissa */ .modal-content { - max-width: 90vw; - max-height: 90vh; + width: 90vw; + height: 90vh; position: relative; + display: flex; + justify-content: center; + align-items: center; } -.modal-content img { - max-width: 100%; - max-height: 100%; +/* 🔥 FIX: contenitore media sempre a dimensione piena */ +#modalMediaContainer { + width: 100%; + height: 100%; + display: flex; + justify-content: center; + align-items: center; +} + +/* 🔥 FIX: preview e full-res occupano lo stesso spazio */ +#modalMediaContainer img, +#modalMediaContainer video { + width: 100%; + height: 100%; + object-fit: contain; display: block; } @@ -140,18 +173,3 @@ header { background: #ddd; outline: none; } - -.video-thumb { - position: relative; -} - -.play-icon { - position: absolute; - bottom: 8px; - right: 8px; - background: rgba(0,0,0,0.6); - color: white; - padding: 4px 6px; - border-radius: 4px; - font-size: 14px; -}