Files
blowfish/assets/js/hero-scroll-fade.js
T
Nuno CoraçãoandClaude Fable 5 09f0573749 ✨ v3 theme: glass UI, landing layout, a11y, perf, print styles
Floating glass header with ⌘K search, landing homepage layout with
hero image and GitHub-stars CTA, background canvas with dissolving
heroes, burufugu colour scheme, movie-quote 404, taxonomy pills,
keyboard/ARIA accessibility across menus, search and tabs, idle-
loaded third-party scripts, and dedicated print styles.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-17 20:19:02 +01:00

25 lines
675 B
JavaScript

(function () {
var script = document.currentScript;
var target = document.getElementById(script.getAttribute("data-hero-id"));
if (!target) return;
var distance = parseInt(script.getAttribute("data-fade-distance"), 10) || 500;
var ticking = false;
function update() {
ticking = false;
var opacity = Math.max(0, 1 - window.scrollY / distance);
target.style.opacity = opacity;
target.style.visibility = opacity === 0 ? "hidden" : "visible";
}
window.addEventListener(
"scroll",
function () {
if (!ticking) {
ticking = true;
requestAnimationFrame(update);
}
},
{ passive: true }
);
update();
})();