window.addEventListener("scroll"... doesn't work

See original GitHub issue

I noticed this problem while using react-infinite and then I tried it in the REPL, I added the following line to the default example: window.addEventListener("scroll",()=>alert("hi")); The listener is registered image But it does nothing.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

22reactions
toniopelocommented, Dec 9, 2020

If someone end up here having the same issue, on my side adding { capture: true } as an options to addEventListener did the trick for me.

8reactions
PetracekSimoncommented, Feb 4, 2021

If someone end up here having the same issue, on my side adding { capture: true } as an options to addEventListener did the trick for me.

thx a lot man ❤️

Read more comments on GitHub >

github_iconTop Results From Across the Web

Javascript Scroll Handler not firing - Stack Overflow
Try changing your element listener to the parent of the div (in this case the window) like this. window.addEventListener("scroll", function () { ...
Read more >
Window Scroll Event NOT Working | Debugging Event Listener
In this video, we will debug an event listener. Events are many: mouse events, touch events, keyboard events, form events, window events, ...
Read more >
Scroll event not working on clients environment ... - OutSystems
The problem is that the scroll event is not working on their environment but working on our end. I tried to attach a...
Read more >
Document: scroll event - Web APIs - MDN Web Docs - Mozilla
For element scrolling, see Element: scroll event . Syntax. Use the event name in methods like addEventListener() , or set an event handler...
Read more >
Scroll events, React Hooks and Refs | Coding time
addEventListener("scroll", handleScroll) } // Now we should attach the listener // any time we render a new div, right? // Unfortunately this does...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found