I'm in the process of creating a landing page that includes CSS animations, such as fade-ins. Initially setting animation-play-state: "paused"
in the CSS file, I later use jQuery to trigger the animation while scrolling through the page.
While this setup works perfectly on Chrome on my Mac, attempting to run it on both Safari and Chrome on my iPhone has proven unsuccessful.
After inspecting console logs and debugging extensively, everything appears to be functioning properly except for the actual animation not running (despite the animation-play-state
changing to "running"
).
One last detail - if I place the
$(".row").css("animation-play-state", "running");
statement before the if
statement, it performs as expected.
Here's the jQuery statement in question:
//the position where I want the animation to trigger
var destinations = $('#destinations').offset().top - 300;
//the event listener
if($(window).scrollTop() > destinations) {
$(".row").css("-webkit-animation-play-state", "running");
$(".row").css("animation-play-state", "running");
}
Any insights on what might be causing this issue? Thank you in advance! Niv