I am trying to make a little project to help a friend. This is the link of the project: Project Link
I want to introduce a bulb that is lighted up on scrolling, but the problem is that I don't know how to stop it when the scrolling stops.
If I try this:
document.addEventListener("scroll", () => {
document.body.classList.add("on");
document.body.classList.remove("on");
});
It doesn't work, now it doesn't even is lighted up. I need a function to be called when the scrolling stops so the bulb "shuts down" only when the scrolls stops for all, but I didn't find anything on MDN Mozilla.
The source code in case you need it: source link