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

Intersection Observer + CSS transform #484

Open
rwlbuis opened this issue Oct 12, 2021 · 3 comments
Open

Intersection Observer + CSS transform #484

rwlbuis opened this issue Oct 12, 2021 · 3 comments

Comments

@rwlbuis
Copy link

rwlbuis commented Oct 12, 2021

I noticed implementations behave differently on Intersection Observer combined with CSS transform:
https://jsfiddle.net/38v2dots/2/

In Firefox the callback is triggered as soon as 1 pixel of the image is visible in the viewport. In Chrome the callback is triggered once the complete CSS transform is finished.

I personally like Firefox behaviour more here. Is there anything in the spec(s) about this? I also wonder what the rules are for CSS animations instead of transforms?

@miketaylr
Copy link
Member

Hi @rwlbuis - thanks for the issue. When testing with Chrome M102 and Firefox Nightly 102 (on Mac), I see the same results in https://jsfiddle.net/38v2dots/2/. Safari, on the other hand, seems to only trigger the callback when the transition if finished. Could you please verify?

@rwlbuis
Copy link
Author

rwlbuis commented Jun 10, 2022

On my Mac Chrome 102 and Safari behave the same, i.e. only trigger the callback when the transition is finished. Firefox 101 still triggers as soon 1 pixel of the image is visible in the viewport, nightly too.

@miketaylr
Copy link
Member

OK, that's a bit odd. I just re-tested and see what you're describing in Chrome 102 as well. I just noticed that if I double click the button (or just spam click it, which I probably did yesterday) in Chrome, I see "Callback triggered! Image is inside!" pretty much immediately. But not in Safari. So that's weird.

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

No branches or pull requests

2 participants