Open panksi opened 5 years ago
I am facing the same issue when an element is bigger than the viewport. It also happens with "e.percentTop". Basically it dose not indicates when you are in the middle of an element. It would be nice if you can implement this little feature as well.
Anyway, thank you very much for the great package. Good work!
Yeah this is currently causing me woes too – I really need it to work for longer elements, as my use-case is tracking scroll position down a series of text elements for a navigation which highlights those currently on the screen.
For what it’s worth, this workaround worked for me:
viewHandler(e, section) {
if (e.percentTop >= 0 && e.percentTop <= 1) {
this.visibleSections.push(section);
} else {
this.visibleSections = this.visibleSections.filter(item => item._key !== section._key);
}
}
So I have an element target which is bigger than viewport size, and viewHandler(e) fires exit from element before it actually leaves the viewport here is the printscreen of console.log
I think this is because element is bigger and then something trippy happens to percent in view
Its not a big issue but I think its worth fixing and making this plugin SUPERAWESOME! Anyway thanks for even making this, it really saved me the time