mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 16:31:52 +01:00
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
11 lines
386 B
JavaScript
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;
|
|
});
|
|
})();
|