I am using scroll animations. I'm using animate.css
library and viewport.js
. It's clearly working. But I want to dynamically add animation delays. For example: I have social media icon list and I want to delay the animation for each item.
This is my JS code:
$(".animateda:in-viewport(-10)").find(".animated").each(function(queue) {
$(this).addClass($(this).attr("data-animation"));
});
I can do it by writing a CSS class for each delay:
.animate-delay-1{animation-duration:.6s;animation-delay:.3s}
.animate-delay-2{animation-duration:.6s;animation-delay:.6s}.....
And use this JS code:
$(this).find(".animated-item").each(function(queue) {
$(this).addClass("animate-delay-"+(queue+1)).addClass($(this).attr("data-animation"));
});
It's working good. But I must write a CSS delay class for all of the objects that have a animation. Can I make the delays with jQuery without using different CSS classes for each object?