admin管理员组

文章数量:1023848

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();
     }
  });

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();
     }
  });

本文标签: plugin developmentJavascript scroll eventHandler only working when I39m logged in in Wordpress