Trying to make a plugin in javascript. The code is working fine except the scroll event which only fires when I'm logged in Wordpress.
The rest of the code (hopefully all) is working as it should when I'm logged out (or in a new session from an incognito window) but this just won't fire up. Why is that?
I'm trying something like this:
document.addEventListener('scroll', function() {
if (window.scrollY > 250) {
run();
}
});