stutrek / scrollmonitor

A simple and fast API to monitor elements as you scroll
MIT License
3.3k stars 243 forks source link

Not working after initial load when using Turbolinks #81

Open JamesHRowe opened 6 years ago

JamesHRowe commented 6 years ago

Im having issues with scrollMonitor and Turbolinks. On initial load the scrollMonitor watchers work and fire correctly but after visiting another page they cease to work. I initially used the Turbolinks "no-cache" tag to stop caching but it to no avail. I have also used "recalculateLocations" to try and re-initialise the positions but still they will not fire.

The only way it will work is with a full page reload but then Turbolinks features become redundant.

stutrek commented 5 years ago

I haven't used it, but it looks like with turbolinks you'll have to recreate your state from scratch. It's swapping out the whole DOM, so you'll have to point scrollmonitor at the new DOM.