Open mvirbicianskas opened 6 years ago
I think inViewport with callback will only be called once, you'd have to re-attach it afterwards if you want to listen continuously.
but shouldn't the inViewport
handle the scroll
event whenever inViewport
is passed a callback? I haven't looked into the source code, but if I remember correctly this is what I've extracted from documentation, or maybe not? 😆 Thanks anyway!
There is a watch API to reattach the watcher: https://github.com/vvo/in-viewport#callback-watcher-api
is it just me and my implementation:
or did something break in the library? Because I tried logging out how many times
inViewport
is called and it seems it only calls twice when the eventDOMContentLoaded
is triggered, but shouldn't theinViewport
create a bunch of events on passed-in element instances?if used with
scroll
event then you loose debounce functionality because everytime onScroll happens theninViewport
is always re-initialised (same like using Immediate resultinViewport(elem);
)