Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery animate not firing callback function

I have the following jQuery animate function:

$myDiv.animate({ "left": "0%" }, { duration: 1000, easing: 'easeInOutExpo' }, 
    function () {
        alert('hi');
    }
);

The animation itself works. $myDiv slides with the easeInOutExpo effect, as desired. However, the callback function is never fired. To test it, I changed the callback to just alert("hi");, as you can see above. Still doesn't work.

What could I be doing wrong?

like image 327
Nullqwerty Avatar asked Mar 19 '23 01:03

Nullqwerty


1 Answers

Try this

Demo: jsFiddle

  $("#myDiv").animate({ "left": "0%" }, { duration: 1000, easing: 'easeInOutExpo' , 
    complete:function () {
        alert('hi');
    }
   }
);
like image 188
Dola Avatar answered Mar 28 '23 14:03

Dola