File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed
Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -123,9 +123,11 @@ function onChange(changes) {
123123 const options = instance . options
124124
125125 let inView = false
126- if ( intersectionRatio < 0 && isIntersecting ) {
127- // Firefox bug, causes intersectionRatio to sometimes be less than zero if element is larger than viewport
128- inView = true
126+
127+ if ( isIntersecting !== undefined ) {
128+ // If isIntersecting is defined, use it to confirm the intersection.
129+ // Firefox can report a negative intersectionRatio, but it will still have correctly set isIntersecting
130+ inView = isIntersecting
129131 } else if ( Array . isArray ( options . threshold ) ) {
130132 // If threshold is an array, check if any of them intersects. This just triggers the onChange event multiple times.
131133 inView = options . threshold . some ( threshold => {
@@ -140,12 +142,6 @@ function onChange(changes) {
140142 : intersectionRatio >= options . threshold
141143 }
142144
143- if ( isIntersecting !== undefined ) {
144- // If isIntersecting is defined, ensure that the element is actually intersecting.
145- // Otherwise it reports a threshold of 0
146- inView = inView && isIntersecting
147- }
148-
149145 // Update the visible value on the instance
150146 instance . visible = inView
151147
You can’t perform that action at this time.
0 commit comments