Skip to content
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

IsFullyEntered is triggered on DomContentLoaded for all items regardless of their state #94

Open
Externaluse opened this issue Apr 30, 2020 · 0 comments

Comments

@Externaluse
Copy link

Initialising a monitor on DomContentLoaded the state is correctly identified in stateChange. However, adding a callback for fullyEnterViewport is also triggered for each item. I would have expected that to fire only for items actually moving into the viewport.
Illustrated here, with console output:
https://jsfiddle.net/ExternalUse/17wL9pxv/9/

In entryChangeState, this produces correct results:
`else if (this.isFullyInViewport):

guid1is correctly considered fully entered here
guid2is correctly considered fully entered here
for the fullyEnteredCallback
function entryFullyEnterViewport() {
console.log(this.watchItem.id + " may to be incorrectly considered fully entered, this.isFullyInViewport is " + this.isFullyInViewport);
}
this is produced:
guid1 may to be incorrectly considered fully entered, this.isFullyInViewport is true
guid2 may to be incorrectly considered fully entered, this.isFullyInViewport is false
guid3 may to be incorrectly considered fully entered, this.isFullyInViewport is false
guid4 may to be incorrectly considered fully entered, this.isFullyInViewport is false
`
...

It's also slightly weird that in stateChange, guid1 and 2 are caught by fullyEntered; in the fullyEntered callback only guid1 has isFullyInViewport == true.

Also, for the first element (guid1) the log message is produced twice.

I'm probably missing a trick, could you possibly help, please?
Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant