Opened 12 years ago
Closed 12 years ago
#9067 closed bug (fixed)
.animate() array easing issue.
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | high | Milestone: | 1.next |
Component: | effects | Version: | 1.6 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
When attempting to perform an animation using:
$("#test").animate({ opacity: [0, "swing"] });
no transition takes place, however, using:
$("#test").animate({ opacity: 0, easing: { opacity: "swing" } });
works as expected.. You can fix the functionality by adding:
if(jQuery.isArray(val)) { (opt.specialEasing = opt.specialEasing || {})[name] = val[1]; prop[name] = val[0]; }
at line 8030 of the full jquery source.. not at home, so can't supply a patch, sorry.
Change History (7)
comment:1 Changed 12 years ago by
Owner: | set to [email protected]… |
---|---|
Status: | new → pending |
comment:2 Changed 12 years ago by
Component: | unfiled → effects |
---|
dmethvin, according to the docs, this wasn't supported. I wonder if the op meant to file as an enhancement?
comment:3 Changed 12 years ago by
Status: | pending → new |
---|
I'm pretty certain it was supported, if you look at http://api.jquery.com/animate/#per-property-easing, those arrays of ["toggle", "swing"] are no longer functioning.
The broken functionality is caused because on line 192 of animate (https://github.com/jquery/jquery/blob/master/src/effects.js#L194), there's a check to see if the value from the options set is an array, and it then uses the second item as an easing method.. unfortunately, it never resets the value to the first item, leading to jQuery attempting to animate say, opacity, to an array value.
The code was broken in change 7666c3ef, you can see the old code before that, (https://github.com/jquery/jquery/blob/eccf15be6cfee8b567785ba29cc8841b1b0c2ef1/src/effects.js#L186) which appropriately sets the value. Without having further inspected the problem, it may be possible to fix just by reverting that one line.
I'll write together a test case to demonstrate the issue.
comment:4 Changed 12 years ago by
demonstrates the issue, switch between 1.5 and 1.6 to see the difference.
comment:5 Changed 12 years ago by
Priority: | undecided → high |
---|---|
Status: | new → open |
yea, this is supported
comment:6 Changed 12 years ago by
there's a pull request for the issue: https://github.com/jquery/jquery/pull/369
comment:7 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | open → closed |
Fix per-property easing. Fixes #9067
Changeset: 3d1c27d52ec667cea5735366a41f65344ab17a5e
Can you provide a test case? Was this a regression from a previous version?