Is there any way to check if css transition will happen?

I set the transition to an object using Javascript:

$(this).css('transition', 'all 1000ms');

And I listen to the end of transition event:

$(this).on('webkitTransitionEnd', function() { alert('Transition did finish.'); });

The event fires and everything works as expected. However, when an element starts with "left: 100px" and you try to animate it to "left: 100px", the event never fires, which causes a problem. How can i fix this? I cannot check the value with respect to the new values ​​because

$(this).css('transform', 'scale(0.1)'); //only when object is being displayed will return matrix value

scale(0.5) does not equal matrix(0.5, 0, 0, 0.5, 0, 0 )
+3
source share
1 answer

the webkit transition fails if your properties are equal, so webkitTransitionEndit won’t start!

I helped explain here: http://jsfiddle.net/JtLAX/

So you need to find a different approach for the callback function.

, setTimeout (function() {}, 1000), , .

, :

http://ricostacruz.com/jquery.transit/

$(this).transit({ left: '+=200' }, function() { alert('transition ends' } );

:

, css?

IMHO, , , .

+4

All Articles