Does jQuery have an animating -event (not :animated )? Something like step , but as an additional method / event?
I am currently triggering a custom event in every step function of the animation:
$('.foo').animate({property: 'value'}, { step: function(now, fx){ $(this).trigger('animating', [now, fx]) } }); $('.foo').on('animating', function(e, now, fx){
I think that somewhere in the wild, of course, is the best solution. Any ideas / approaches?
Update
I wrote a (of course not awesome) special event, which facilitates the handling of this problem:
(function($){ var oldStep = $.fx.step._default; jQuery.event.special.animating = { }; $.fx.step._default = function( fx ) { $(fx.elem).trigger('animating', fx); oldStep.apply( this, arguments ); }; }(jQuery));
This does not work with jQuery 1.7+, since the jQuery animation method has been changed, or rather, the step function is no longer extended ($ .fx.step results in an empty object ).
jQuery.fx refers to Tween.prototype.init; & Amp; jQuery.fx.step to {};
So this will not work ...
I look further at each tip!