[Solved] How to achieve continuous animation in jQuery [closed]


DEMO jsBin

Code used:

<img id="arrow" src="arrow.png">

var ar = $('#arrow');
function pulsate(){ 
  ar.animate({width:'+=5',height:'+=5'},300,function(){
    ar.animate({width:'-=5',height:'-=5'},300,pulsate);
  });
}
pulsate();

(Hope that’s what you were looking for…)


P.S.
You can also encapsulate the function like:

var ar = $('#arrow');
(function tic(){ 
  ar.animate({width:'+=5',height:'+=5'},300,function(){
    ar.animate({width:'-=5',height:'-=5'},300,tic);
  });
})();

solved How to achieve continuous animation in jQuery [closed]