I need to make an animation title that changes color after a certain time, then return to the original color, and keep changing between two colors indefinitely.
I need to make an animation title that changes color after a certain time, then return to the original color, and keep changing between two colors indefinitely.
In addition to jQuery, you need to add jQueryUI to your web in the head or add this library to animate colors:
<script src="//cdn.jsdelivr.net/jquery.color-animation/1/mainfile"></script>
Then in JQuery:
$(document).ready(function()
{
animateForever();
});
function animateForever()
{
var div = $('h1');
var color1 = '#A333FF';
var color2 = '#3BD6C6';
div.animate({color: color1}, 1000, function()
{
div.animate({color: color2}, 1000, function()
{
animateForever();
});
});
}
I'll leave you a Plunker so you can see it: link