Сделать lightbox на всю высоту экрана с небольшими отступами

Панель занимает 100dvh минус 1rem сверху/снизу; QR растягивается
в оставшееся пространство.
This commit is contained in:
2026-07-23 09:16:45 +03:00
parent 912938e6cf
commit 28df4f4a04
2 changed files with 46 additions and 18 deletions
@@ -262,7 +262,7 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding: 1.75rem 1rem; padding: 1rem;
box-sizing: border-box; box-sizing: border-box;
background: rgba(8, 12, 18, 0.72); background: rgba(8, 12, 18, 0.72);
backdrop-filter: blur(10px); backdrop-filter: blur(10px);
@@ -279,16 +279,19 @@
} }
.lightbox-panel { .lightbox-panel {
position: relative; position: relative;
max-width: min(94vw, 832px); display: flex;
max-height: calc(100dvh - 3.5rem); flex-direction: column;
width: 100%; width: min(94vw, 900px);
height: calc(100dvh - 2rem);
max-height: calc(100dvh - 2rem);
padding: 1.25rem 1.25rem 1rem; padding: 1.25rem 1.25rem 1rem;
background: var(--bg-card); background: var(--bg-card);
border: 1px solid var(--border); border: 1px solid var(--border);
border-radius: 18px; border-radius: 18px;
box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
text-align: center; text-align: center;
overflow: auto; overflow: hidden;
box-sizing: border-box;
transform: translateY(12px) scale(0.96); transform: translateY(12px) scale(0.96);
transition: transform 0.22s ease; transition: transform 0.22s ease;
} }
@@ -297,11 +300,10 @@
} }
.lightbox-panel img { .lightbox-panel img {
display: block; display: block;
max-width: 100%;
max-height: 100%;
width: auto; width: auto;
height: auto; height: auto;
max-width: min(728px, 100%);
max-height: min(728px, calc(100dvh - 14rem));
margin: 0 auto;
aspect-ratio: 1; aspect-ratio: 1;
object-fit: contain; object-fit: contain;
background: #fff; background: #fff;
@@ -310,18 +312,28 @@
box-sizing: border-box; box-sizing: border-box;
image-rendering: pixelated; image-rendering: pixelated;
} }
.lightbox-media {
flex: 1 1 auto;
min-height: 0;
display: flex;
align-items: center;
justify-content: center;
}
.lightbox-caption { .lightbox-caption {
flex-shrink: 0;
margin-top: 0.85rem; margin-top: 0.85rem;
font-size: 0.95rem; font-size: 0.95rem;
font-weight: 650; font-weight: 650;
color: var(--text); color: var(--text);
} }
.lightbox-hint { .lightbox-hint {
flex-shrink: 0;
margin-top: 0.25rem; margin-top: 0.25rem;
font-size: 0.75rem; font-size: 0.75rem;
color: var(--muted); color: var(--muted);
} }
.lightbox-actions { .lightbox-actions {
flex-shrink: 0;
margin-top: 1rem; margin-top: 1rem;
display: flex; display: flex;
justify-content: center; justify-content: center;
@@ -522,7 +534,9 @@
<div class="lightbox" id="lightbox" role="dialog" aria-modal="true" aria-hidden="true" aria-labelledby="lightbox-caption"> <div class="lightbox" id="lightbox" role="dialog" aria-modal="true" aria-hidden="true" aria-labelledby="lightbox-caption">
<div class="lightbox-panel" role="document"> <div class="lightbox-panel" role="document">
<button type="button" class="lightbox-close" id="lightbox-close" aria-label="Закрыть">&times;</button> <button type="button" class="lightbox-close" id="lightbox-close" aria-label="Закрыть">&times;</button>
<div class="lightbox-media">
<img id="lightbox-img" src="" alt=""> <img id="lightbox-img" src="" alt="">
</div>
<p class="lightbox-caption" id="lightbox-caption"></p> <p class="lightbox-caption" id="lightbox-caption"></p>
<div class="lightbox-actions"> <div class="lightbox-actions">
<a class="lightbox-download" id="lightbox-download" href="#" download> <a class="lightbox-download" id="lightbox-download" href="#" download>
+22 -8
View File
@@ -193,7 +193,7 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding: 1.75rem 1rem; padding: 1rem;
box-sizing: border-box; box-sizing: border-box;
background: rgba(8, 12, 18, 0.72); background: rgba(8, 12, 18, 0.72);
backdrop-filter: blur(10px); backdrop-filter: blur(10px);
@@ -210,16 +210,19 @@
} }
.lightbox-panel { .lightbox-panel {
position: relative; position: relative;
max-width: min(94vw, 832px); display: flex;
max-height: calc(100dvh - 3.5rem); flex-direction: column;
width: 100%; width: min(94vw, 900px);
height: calc(100dvh - 2rem);
max-height: calc(100dvh - 2rem);
padding: 1.25rem 1.25rem 1rem; padding: 1.25rem 1.25rem 1rem;
background: var(--bg-card); background: var(--bg-card);
border: 1px solid var(--border); border: 1px solid var(--border);
border-radius: 18px; border-radius: 18px;
box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
text-align: center; text-align: center;
overflow: auto; overflow: hidden;
box-sizing: border-box;
transform: translateY(12px) scale(0.96); transform: translateY(12px) scale(0.96);
transition: transform 0.22s ease; transition: transform 0.22s ease;
} }
@@ -228,11 +231,10 @@
} }
.lightbox-panel img { .lightbox-panel img {
display: block; display: block;
max-width: 100%;
max-height: 100%;
width: auto; width: auto;
height: auto; height: auto;
max-width: min(728px, 100%);
max-height: min(728px, calc(100dvh - 14rem));
margin: 0 auto;
aspect-ratio: 1; aspect-ratio: 1;
object-fit: contain; object-fit: contain;
background: #fff; background: #fff;
@@ -241,18 +243,28 @@
box-sizing: border-box; box-sizing: border-box;
image-rendering: pixelated; image-rendering: pixelated;
} }
.lightbox-media {
flex: 1 1 auto;
min-height: 0;
display: flex;
align-items: center;
justify-content: center;
}
.lightbox-caption { .lightbox-caption {
flex-shrink: 0;
margin-top: 0.85rem; margin-top: 0.85rem;
font-size: 0.95rem; font-size: 0.95rem;
font-weight: 650; font-weight: 650;
color: var(--text); color: var(--text);
} }
.lightbox-hint { .lightbox-hint {
flex-shrink: 0;
margin-top: 0.25rem; margin-top: 0.25rem;
font-size: 0.75rem; font-size: 0.75rem;
color: var(--muted); color: var(--muted);
} }
.lightbox-actions { .lightbox-actions {
flex-shrink: 0;
margin-top: 1rem; margin-top: 1rem;
display: flex; display: flex;
justify-content: center; justify-content: center;
@@ -444,7 +456,9 @@
<div class="lightbox" id="lightbox" role="dialog" aria-modal="true" aria-hidden="true" aria-labelledby="lightbox-caption"> <div class="lightbox" id="lightbox" role="dialog" aria-modal="true" aria-hidden="true" aria-labelledby="lightbox-caption">
<div class="lightbox-panel" role="document"> <div class="lightbox-panel" role="document">
<button type="button" class="lightbox-close" id="lightbox-close" aria-label="Закрыть">&times;</button> <button type="button" class="lightbox-close" id="lightbox-close" aria-label="Закрыть">&times;</button>
<div class="lightbox-media">
<img id="lightbox-img" src="" alt=""> <img id="lightbox-img" src="" alt="">
</div>
<p class="lightbox-caption" id="lightbox-caption"></p> <p class="lightbox-caption" id="lightbox-caption"></p>
<div class="lightbox-actions"> <div class="lightbox-actions">
<a class="lightbox-download" id="lightbox-download" href="#" download> <a class="lightbox-download" id="lightbox-download" href="#" download>