update
This commit is contained in:
parent
03c949637d
commit
22bdb42dc1
2 changed files with 80 additions and 16 deletions
86
index.html
86
index.html
|
|
@ -80,7 +80,7 @@
|
||||||
.video-grid {
|
.video-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(3, 1fr);
|
grid-template-columns: repeat(3, 1fr);
|
||||||
gap: 16px;
|
gap: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.video-tile {
|
.video-tile {
|
||||||
|
|
@ -101,7 +101,7 @@
|
||||||
|
|
||||||
.video-tile.fade-in {
|
.video-tile.fade-in {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transform: translateY(20px);
|
transform: translateY(50px);
|
||||||
transition: opacity 0.8s ease, transform 0.8s ease;
|
transition: opacity 0.8s ease, transform 0.8s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -137,7 +137,30 @@
|
||||||
font-size: 0.8rem;
|
font-size: 0.8rem;
|
||||||
color: #ccc;
|
color: #ccc;
|
||||||
}
|
}
|
||||||
</style>
|
|
||||||
|
#scrollToTopBtn {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 20px;
|
||||||
|
right: 20px;
|
||||||
|
z-index: 999;
|
||||||
|
background-color: rgba(255, 255, 255, 0.1);
|
||||||
|
border: 1px solid #888;
|
||||||
|
color: #eee;
|
||||||
|
font-size: 1.5em;
|
||||||
|
padding: 0.2em 0.6em;
|
||||||
|
border-radius: 0.4em;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: opacity 0.3s ease;
|
||||||
|
opacity: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#scrollToTopBtn.show {
|
||||||
|
opacity: 1;
|
||||||
|
pointer-events: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;600&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;600&display=swap" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
@ -290,7 +313,7 @@
|
||||||
video.poster = `${src.replace(/\.mp4$/, '.jpg')}`;
|
video.poster = `${src.replace(/\.mp4$/, '.jpg')}`;
|
||||||
video.muted = true;
|
video.muted = true;
|
||||||
video.loop = true;
|
video.loop = true;
|
||||||
video.preload = 'none';
|
video.preload = 'auto';
|
||||||
video.playsInline = true;
|
video.playsInline = true;
|
||||||
video.dataset.src = src;
|
video.dataset.src = src;
|
||||||
|
|
||||||
|
|
@ -306,14 +329,17 @@
|
||||||
videoObserver.observe(video);
|
videoObserver.observe(video);
|
||||||
|
|
||||||
tile.addEventListener('mouseenter', () => {
|
tile.addEventListener('mouseenter', () => {
|
||||||
if (!video.src) video.src = video.dataset.src;
|
if (!video.src) {
|
||||||
video.play();
|
video.src = video.dataset.src;
|
||||||
|
video.preload = 'auto';
|
||||||
|
}
|
||||||
|
video.play().catch(() => {});
|
||||||
});
|
});
|
||||||
tile.addEventListener('mouseleave', () => {
|
|
||||||
|
tile.addEventListener('mouseleave', () => {
|
||||||
video.pause();
|
video.pause();
|
||||||
video.removeAttribute('src');
|
});
|
||||||
video.load();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -343,11 +369,12 @@ const videoObserver = new IntersectionObserver((entries, observer) => {
|
||||||
const video = entry.target;
|
const video = entry.target;
|
||||||
if (!video.src) {
|
if (!video.src) {
|
||||||
video.src = video.dataset.src;
|
video.src = video.dataset.src;
|
||||||
|
video.preload = 'auto';
|
||||||
}
|
}
|
||||||
observer.unobserve(video);
|
observer.unobserve(video);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, { rootMargin: '200px 0px' });
|
}, { rootMargin: '800px 0px' });
|
||||||
|
|
||||||
window.addEventListener('scroll', handleScroll);
|
window.addEventListener('scroll', handleScroll);
|
||||||
window.addEventListener('load', () => {
|
window.addEventListener('load', () => {
|
||||||
|
|
@ -368,6 +395,40 @@ const videoObserver = new IntersectionObserver((entries, observer) => {
|
||||||
h1.style.letterSpacing = "";
|
h1.style.letterSpacing = "";
|
||||||
h1.style.transition = "letter-spacing 1s ease";
|
h1.style.transition = "letter-spacing 1s ease";
|
||||||
});
|
});
|
||||||
|
window.addEventListener("scroll", () => {
|
||||||
|
const maxSpacing = 1.2;
|
||||||
|
const maxScroll = 600;
|
||||||
|
const scrollY = window.scrollY;
|
||||||
|
const spacing = Math.min(scrollY / maxScroll * maxSpacing, maxSpacing);
|
||||||
|
if (!h1.matches(':hover')) {
|
||||||
|
h1.style.letterSpacing = spacing + "em";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
window.addEventListener("scroll", () => {
|
||||||
|
const baseMaxSpacing = 0.0012; // коэффициент
|
||||||
|
const maxScroll = 3000;
|
||||||
|
const scrollY = window.scrollY;
|
||||||
|
const dynamicMaxSpacing = window.innerWidth * baseMaxSpacing;
|
||||||
|
const spacing = Math.min(scrollY / maxScroll * dynamicMaxSpacing, dynamicMaxSpacing);
|
||||||
|
if (!h1.matches(':hover')) {
|
||||||
|
h1.style.letterSpacing = spacing + "em";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
const scrollToTopBtn = document.getElementById("scrollToTopBtn");
|
||||||
|
window.addEventListener("scroll", () => {
|
||||||
|
if (window.scrollY > 300) {
|
||||||
|
scrollToTopBtn.classList.add("show");
|
||||||
|
} else {
|
||||||
|
scrollToTopBtn.classList.remove("show");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
scrollToTopBtn.addEventListener("click", () => {
|
||||||
|
window.scrollTo({ top: 0, behavior: "smooth" });
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -375,5 +436,8 @@ const videoObserver = new IntersectionObserver((entries, observer) => {
|
||||||
fetch("/.netlify/functions/privateViewLogger?key=flat_secret_123");
|
fetch("/.netlify/functions/privateViewLogger?key=flat_secret_123");
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<button id="scrollToTopBtn" title="Back to top">⇧</button>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -8,18 +8,18 @@ body {
|
||||||
|
|
||||||
header {
|
header {
|
||||||
background: #222;
|
background: #222;
|
||||||
padding: 2em;
|
padding: 2em 1em 1em;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
main {
|
main {
|
||||||
max-width: 1280px;
|
max-width: 1280px;
|
||||||
margin: 2em auto;
|
margin: 0 auto;
|
||||||
padding: 0 1em;
|
padding: 0 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
section {
|
section {
|
||||||
margin-bottom: 2em;
|
margin-bottom: 0em;
|
||||||
}
|
}
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
|
|
@ -34,7 +34,7 @@ footer {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 1280px;
|
max-width: 1280px;
|
||||||
margin: 0 auto 2em;
|
margin: 0 auto;
|
||||||
aspect-ratio: 16 / 9; /* это заменяет padding-bottom */
|
aspect-ratio: 16 / 9; /* это заменяет padding-bottom */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue