I’m using jquery to pulsate text. All fine – but I can’t get my head around something: I would only like to pulsate x-number of times and then stop. I’m using the following code to pulsate a class:
$(document).ready(function() {
function pulsate() {
$(".pulsate").
animate({opacity: 0.2}, 1000, 'linear').
animate({opacity: 1}, 1000, 'linear', pulsate);
}
pulsate();
});
Any ideas how this can be achived? Probably one line of code…?!
The simplest way is to just count:
Try it here. Or, queue up all the animations at once in a
forloop, like this:Try that version here.