There is a button that should have a pulsating text. Made the animation as follows:

setInterval(function () { $(".form button").animate({"font-size":"22px"}, 500, "linear").delay(500).animate({"font-size":"20px"}, 500, "linear"); }, 1000); 

But after performing the animation, before performing the next cycle, there is a slight delay. How to loop animation so that there is no delay? Also, there is no delay between the animation from a larger font to a smaller one.

  • a counter question, it was necessary to do only js / jq? simple css copes with it perfectly. - NeedHate

1 answer 1

Can through callback ...

 setInterval(function() { $(".button").animate({ "font-size": "22px" }, 500, "linear"), $(".button").animate({ "font-size": "20px" }, 500, "linear"); }, 1000); 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <span class="button">zzzzzzzzz</span>