Skip to main content

Bug Tracker

Side navigation

#10364 closed bug (invalid)

Opened September 28, 2011 11:39AM UTC

Closed November 18, 2011 03:12PM UTC

Animate and stop on a object

Reported by: anonymous Owned by: anonymous
Priority: low Milestone: None
Component: effects Version: 1.6.4
Keywords: Cc:
Blocked by: Blocking:
Description

Hi,

I animate an object. When the animation finish, i stop all animations on this object (to be sure that no other animation are still running), and set an other animation on this object: it doesn't work.

A script example:

$(function($) {

  o={i:1}

  oW=$(o);
  oH=$(o);

  oW.animate({i:10},{duration:2000,complete:function(){
    alert('first animate complete');
    oW.stop(true);
    oW.animate({i:20},{duration:2000,complete:function(){
        alert('second animate never complete')
    }});
  }});

});
Attachments (0)
Change History (5)

Changed September 30, 2011 12:42PM UTC by palickil@hotmail.com comment:1

The problem is in the step function. The complete function is called in synchronous mode.

The first complete function is executed when the current step function is not finished. So the stop function stop the next animation.

To solve this problem:

line 8543 of jquery-1.6.4.js source in the step function, don't call directly the complete function but use a setTimeout to have an asynchronous call:

setTimeout($.proxy(options.complete,elem),2);

In the same way the trigger function is not asynchronous. Normally events are asynchronous, so it would be interressant to do the same way as before. A suggestion:

$.fn.triggerH=function(eventType, extraParameters) {
  setTimeout($.proxy(this.triggerHandler,this), 2, eventType, extraParameters);
}

Changed November 05, 2011 09:55PM UTC by timmywil comment:2

component: unfiledeffects
owner: → anonymous
priority: undecidedlow
status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.

Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.

Changed November 18, 2011 02:31PM UTC by kiplaic comment:3

Thanks!

It's ok for the complete function from animate.

But the trigger function is not also asynchronous. Please see the following example.

http://jsfiddle.net/rD9at/

I understand that this change is not possible on the current trigger functions: The behavior should be very too different. But is it possible to add a new trigger function that would be asynchronous. You can call it triggerAsync or triggerAsyncrone or else

Thank you in advance

Changed November 18, 2011 02:41PM UTC by kiplaic comment:4

oh sorry!

I have upadted your link: http://jsfiddle.net/FrKyN/129/

The result for the complete function in animate is correct for jQuery(edge)and jQuery 1.7.

thanks

Changed November 18, 2011 03:12PM UTC by timmywil comment:5

resolution: → invalid
status: pendingclosed

Thank you for investigating the issue further.