-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InfiniteScroll: fix avoid event trigger when element invisible #16681
Conversation
invalid event trigger when element invisible
Deploy preview for element ready! Built with commit 9552815 |
|
yeah. when the element is invisible,may be its parent element or self invisible. now when trigger scroll event,it will check the element visible status,if true ,go on ,if false,just return. the scroll event like a observer. |
yeah, but the problem is no scroll at first. template
js
|
v-infinite-scroll directive will bind the container's scroll event on inserted hooks. so if word is not correct.you can provider a reproduction link? |
linkhttps://codepen.io/a631807682/pen/jgqqJy?editors=1011#0 i chang the link to setp
|
@qingdengyue same problem to me, please check the link above |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i suggest to create IntersectionObserver
to watch element visible status when invisible, like this:
if (!isElementVisible(el) && !visibleObserver) {
visibleObserver = new IntersectionObserver(onScroll);
visibleObserver.observe(el);
}
ps: i am new to review, i chose to approved
, but actually i wanted to choose request change
and i don't know how to change it.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Please make sure these boxes are checked before submitting your PR, thank you!
dev
branch.