히어로 수정
썸네일 적용
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 63 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 61 KiB |
|
After Width: | Height: | Size: 50 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 66 KiB |
|
After Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 86 KiB |
|
After Width: | Height: | Size: 48 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 100 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 79 KiB |
|
After Width: | Height: | Size: 83 KiB |
|
After Width: | Height: | Size: 271 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 23 KiB |
@@ -95,7 +95,7 @@
|
||||
align-items: stretch;
|
||||
justify-content: center;
|
||||
padding: 0;
|
||||
background: #d8cbc4;
|
||||
background: #f7f7f7;
|
||||
overflow: hidden;
|
||||
margin-left: -215px;
|
||||
transition:
|
||||
@@ -115,7 +115,7 @@
|
||||
.hero-spacer {
|
||||
height: 100vh;
|
||||
height: 100svh;
|
||||
background: #d8cbc4;
|
||||
background: #f7f7f7;
|
||||
transition: height 420ms cubic-bezier(.2, .8, .2, 1);
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
height: 100%;
|
||||
display: block;
|
||||
object-fit: contain;
|
||||
background: #d8cbc4;
|
||||
background: #f7f7f7;
|
||||
image-rendering: auto;
|
||||
}
|
||||
|
||||
@@ -743,7 +743,7 @@
|
||||
<body>
|
||||
<main class="shell">
|
||||
<header class="hero" data-aos="hero-cover" data-aos-duration="680" data-aos-once="true">
|
||||
<img class="main-invitation" src="./images/hero.jpg" alt="김도아 돌잔치 초대장">
|
||||
<img class="main-invitation" src="./images/thumbs/hero.jpg" alt="김도아 돌잔치 초대장" fetchpriority="high">
|
||||
<!-- <a class="scroll-cue" href="#intro">스크롤<span></span></a> -->
|
||||
</header>
|
||||
<div class="hero-spacer" aria-hidden="true"></div>
|
||||
@@ -937,6 +937,18 @@
|
||||
img.src = DATA.images[img.dataset.img];
|
||||
});
|
||||
|
||||
const toThumbnailPath = (image) => {
|
||||
if (image.startsWith("./images/")) {
|
||||
return image.replace("./images/", "./images/thumbs/");
|
||||
}
|
||||
|
||||
if (image.startsWith("/images/")) {
|
||||
return image.replace("/images/", "/images/thumbs/");
|
||||
}
|
||||
|
||||
return image;
|
||||
};
|
||||
|
||||
const openRouteLink = (event) => {
|
||||
const route = DATA.links[event.currentTarget.dataset.link];
|
||||
const isMobile = /Android|iPhone|iPad|iPod/i.test(navigator.userAgent);
|
||||
@@ -1082,7 +1094,7 @@
|
||||
document.querySelector("#timeline").innerHTML = DATA.timeline.map(([date, text, image]) => `
|
||||
<article class="milestone">
|
||||
<div class="milestone-visual">
|
||||
<img src="${image}" alt="">
|
||||
<img src="${toThumbnailPath(image)}" data-full="${image}" alt="" loading="lazy" decoding="async">
|
||||
</div>
|
||||
<div class="milestone-copy">
|
||||
<time>${date}</time>
|
||||
@@ -1104,7 +1116,7 @@
|
||||
galleryGridSlides.innerHTML = galleryGroups.map((group) => `
|
||||
<div class="swiper-slide">
|
||||
<div class="gallery-grid">
|
||||
${group.map((image) => `<img src="${image}" alt="">`).join("")}
|
||||
${group.map((image) => `<img src="${toThumbnailPath(image)}" data-full="${image}" alt="" loading="lazy" decoding="async">`).join("")}
|
||||
</div>
|
||||
</div>
|
||||
`).join("");
|
||||
@@ -1155,7 +1167,7 @@
|
||||
};
|
||||
|
||||
document.querySelectorAll(".milestone img, .gallery-grid img, .slider .swiper-slide img").forEach((image) => {
|
||||
image.addEventListener("click", () => openLightbox(image.currentSrc || image.src, image.alt));
|
||||
image.addEventListener("click", () => openLightbox(image.dataset.full || image.currentSrc || image.src, image.alt));
|
||||
});
|
||||
|
||||
closeButton.addEventListener("click", closeLightbox);
|
||||
@@ -1232,6 +1244,7 @@
|
||||
const heroSpacer = document.querySelector(".hero-spacer");
|
||||
let touchStartY = 0;
|
||||
let isDismissed = false;
|
||||
let isRestoringHero = false;
|
||||
|
||||
if (!hero) {
|
||||
return;
|
||||
@@ -1242,8 +1255,28 @@
|
||||
hero.classList.remove("is-dismissed");
|
||||
heroSpacer?.classList.remove("is-collapsed");
|
||||
|
||||
const showHero = () => {
|
||||
if (!isDismissed || isRestoringHero) {
|
||||
return;
|
||||
}
|
||||
|
||||
isRestoringHero = true;
|
||||
isDismissed = false;
|
||||
window.scrollTo({ top: 0, behavior: "auto" });
|
||||
heroSpacer?.classList.remove("is-collapsed");
|
||||
hero.classList.add("aos-init", "aos-animate");
|
||||
hero.classList.remove("is-dismissed");
|
||||
|
||||
window.setTimeout(() => {
|
||||
isRestoringHero = false;
|
||||
if (window.AOS) {
|
||||
AOS.refreshHard();
|
||||
}
|
||||
}, 460);
|
||||
};
|
||||
|
||||
const dismissHero = () => {
|
||||
if (isDismissed) {
|
||||
if (isDismissed || isRestoringHero) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1291,6 +1324,14 @@
|
||||
event.preventDefault();
|
||||
dismissHero();
|
||||
});
|
||||
|
||||
window.addEventListener("scroll", () => {
|
||||
if (!isDismissed || window.scrollY > 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
showHero();
|
||||
}, { passive: true });
|
||||
};
|
||||
|
||||
if (document.readyState === "complete") {
|
||||
|
||||