Skip to content

Commit

Permalink
lighthouse
Browse files Browse the repository at this point in the history
fix : Does not use passive listeners to improve scrolling performance
  • Loading branch information
bilelz committed Mar 29, 2024
1 parent a127aa3 commit f3856ab
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,13 +372,17 @@ function timerGoToFront() {
}

// CSP grrrrrrrr : https://content-security-policy.com/unsafe-hashes/
document.getElementById("webdev").addEventListener("scroll", (event) => {
if (event.target.scrollY > 12 || event.target.scrollTop > 12) {
document.body.classList.add("scrolled");
} else {
document.body.classList.remove("scrolled");
}
});
document.getElementById("webdev").addEventListener(
"scroll",
(event) => {
if (event.target.scrollY > 12 || event.target.scrollTop > 12) {
document.body.classList.add("scrolled");
} else {
document.body.classList.remove("scrolled");
}
},
{ passive: true }
);
document.getElementById("playAnim").addEventListener("click", () => {
playAnim();
});
Expand Down Expand Up @@ -554,7 +558,7 @@ for (let gestureZone of gestureZones) {
// document.querySelector(".cube").style.transform = `translateZ(-50vw) rotateY(${rotatestartY}deg)`;
// }
},
false
{ passive: true }
);

gestureZone.addEventListener(
Expand All @@ -567,7 +571,7 @@ for (let gestureZone of gestureZones) {
touchendY = event.changedTouches[0].screenY;
handleGesture(gestureZone);
},
false
{ passive: true }
);
}

Expand Down Expand Up @@ -611,15 +615,15 @@ for (let nog of nogestureZones) {
event.stopImmediatePropagation();
event.stopPropagation();
},
false
{ passive: true }
);
nog.addEventListener(
"touchend",
(event) => {
event.stopImmediatePropagation();
event.stopPropagation();
},
false
{ passive: true }
);
}

Expand Down

0 comments on commit f3856ab

Please sign in to comment.