Files
blowfish/assets/js/background-blur.js
Served Smart 1e9458802a ♻️ Refactor: Use IIFE for background-blur and simplify code
This improves readability and removes an unnecessary function declaration by using IIFE.

This is inspired by https://github.com/nunocoracao/blowfish/pull/2262 . If both are merged, this would enhance consistency
2025-06-27 19:19:28 +02:00

11 lines
386 B
JavaScript

(() => {
const script = document.currentScript;
const targetId = script?.getAttribute("data-target-id");
window.addEventListener("scroll", () => {
const scroll = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
const backgroundBlur = document.getElementById(targetId);
backgroundBlur.style.opacity = scroll / 300;
});
})();