jQuery animate start -


is there way call function right before jquery animation starts? want have method fired before each animation in potentially long queue.

i know .animate() function has start option, it's being called when animation added queue not when begins.

try utilizing jquery.deferred()

var beforestart = function beforestart() {    $("body").append("<br>beforestart", $.now());    return $.deferred(function(dfd) {      settimeout(dfd.resolve, 3000)    }).promise()  };    $.when(beforestart())  .then(function() {    $("div").animate({        top:48      }, {        duration:3000,        start:function() {          $("body").append("<br>animation start", $.now());        }             });  })
div {    position:relative;    top:0px;  }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js">  </script>  <div>abc</div>


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -