rstacruz / jquery.transit

Super-smooth CSS3 transformations and transitions for jQuery
http://ricostacruz.com/jquery.transit
7.29k stars 862 forks source link

obj.is(':animated') always return false #74

Open guycalledseven opened 12 years ago

guycalledseven commented 12 years ago

After obj.transition is executed, obj.is(':animated') always return false.

This is a serious bug because chaining of multiple transitions on eg. click cannot be disabled. Or at least I have no idea how to do it.

Thanks in advance!

gavinsmith commented 12 years ago

I've got this problem too. Tried using browsers' events for direct binding as well. None return when an animation is Transit-initiated, but a quick change in Webkit Inspector resulting in an animation will trigger these events without issue.

Looks like this:

$('.flap').bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(){
    console.log('animation stopped');
});

Tested in Chrome 21 & 23.0.1263.1. Running jQuery 1.7.2.

rstacruz commented 11 years ago

Transit can't hook onto :animated, but I can probably implement an :transitioning selector.

rstacruz commented 11 years ago

If anyone wants to take a stab at it, it's hypothetically:

$.expr[':'].transitioning = function(el) {
  return !! $(el).data('something');
}

...where something is some flag set by .transition() and removed by transitionend.

run-byte-run commented 11 years ago

mb like this: $.expr.filters.transitioning = function(el) { return !!$(el).queue("fx").length; }