I have created a custom animation class in CSS which I am dynamically adding to an element using jQuery. My custom animation class begins once an animate.css animation has completed.
The issue I am having is my custom animation is not playing, and for the life of me I can't figure out what I am doing wrong. I can see in dev tools that the class is being added to my element but the animation is not occurring.
custom-fade css:
.custom-fade{
-webkit-animation: 3s ease 0s normal forwards 1 custom;
animation: 3s ease 0s normal forwards 1 custom;
}
@keyframes custom{
0% { opacity:.5; }
66% { opacity:.2; }
100% { opacity:0; }
}
@-webkit-keyframes custom{
0% { opacity: .5; }
66% { opacity: .2; }
100% { opacity: 0; }
}
@-moz-keyframes custom{
0% { opacity: .5; }
66% { opacity: .2; }
100% { opacity: 0; }
}
jQuery:
var animationEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend';
var fadeInUp = 'animated fadeIn fadeInUp';
var fadeOut = 'animated fadeOut';
var customFade = '.custom-fade';
$('.bg-img').addClass(fadeInUp);
$('.bg-img').one( animationEnd, function(){
$(this).removeClass(fadeInUp).addClass('.custom-fade');
});
$('.bg-img').on(...)