Page loaded below waypoint
See original GitHub issueIs there a way to detect if the page has been loaded below a waypoint? Basically let’s say you have a waypoint that you reach as you scroll down. This triggers onEnter
and onLeave
, however if you have a page where you start below the waypoint, these won’t get triggered. Is there a way to detect the current scroll position relative to the waypoint?
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Waypoints.js: check if element is in view on page load
This way, the handler function will be called upon pageload if the element in question is in the viewport. Below is a working...
Read more >react-waypoint - npm
React Waypoint can be used to build features like lazy loading content, infinite scroll, scrollspies, or docking elements to the viewport on ...
Read more >Page loaded below waypoint - - Bountysource
Basically let's say you have a waypoint that you reach as you scroll down. This triggers onEnter and onLeave , however if you...
Read more >GPS GPX Batch Waypoint and Route Creator - L-36.com
This page works for about 500 waypoints. ... or you can start with the output from another program that outputs .gpx files like...
Read more >jQuery code messing up rest of code - Forums - CSS-Tricks
(By messing up I mean I don't believe code below fires.) ... Is the Waypoint library loaded before this JS is called?
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
componentDidMount
solutions leave a window of time (1/3 to 1/2 second in my testing) between the component mount and Waypoint’s resize handlers. If someone scrolls during that time, your app state will still be out of sync.Although onLeave doesn’t get called on initial render, onPositionChange does. As a workaround, you can take advantage of that. This code causes onEnter and onLeave to mirror each other, and avoids fighting with the
setTimeout
inside react-waypoint.@dzucconi I traced that log down to this test case: https://github.com/brigade/react-waypoint/blob/68d1948b26509941ec601057d1df989bb68366de/test/waypoint_test.jsx#L874
I’ve pushed a PR addressing the confusion around the error message here: https://github.com/brigade/react-waypoint/pull/255. You can safely ignore the error log.