Skip to content

Commit 79b737d

Browse files
Merge pull request #2027 from Codeinwp/fix/issue-2005
fix: animation not trigger for large elements on screen
2 parents f17e7b4 + d3fec2c commit 79b737d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/animation/frontend.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,9 @@ const isElementInViewport = ( el ) => {
284284
};
285285

286286
return (
287-
( bounds.bottom >= viewport.top && bounds.bottom <= viewport.bottom ) ||
288-
( bounds.top <= viewport.bottom && bounds.top >= viewport.top )
287+
( bounds.bottom >= viewport.top && bounds.top <= viewport.bottom ) || // Element spans the viewport
288+
( bounds.top <= viewport.bottom && bounds.bottom >= viewport.bottom ) || // Top part of the element is in the viewport
289+
( bounds.bottom >= viewport.top && bounds.top <= viewport.top ) // Bottom part of the element is in the viewport
289290
);
290291
};
291292

0 commit comments

Comments
 (0)