I'm currently building a landing page with some css animations (pretty basic fade-ins). I initially set animation-play-state: "paused"
in my css file, and later on access it with jQuery while scrolling the page, to trigger the animation.
Works perfectly fine on Chrome on my Mac, but trying to run it from both Safari and Chrome on my iPhone does not seems to work.
I inspected the console logs and debugged it as far as I could think, everything seems to work but the actual animation does not run (however the animation-play-state
is changing to "running"
.
Last thing to add, if I put the $(".row").css("animation-play-state", "running");
statement before the if
statement, it does exactly what it supposed to do.
My jQuery statement is:
//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");
}
Anyone knows the problem? Thanks a lot in advance! Niv