Ticket #9067 (closed bug: fixed)
.animate() array easing issue.
| Reported by: | sciolist.se@… | Owned by: | sciolist.se@… |
|---|---|---|---|
| Priority: | high | Milestone: | 1.next |
| Component: | effects | Version: | 1.6 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
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
comment:1 Changed 2 years ago by dmethvin
- Owner set to sciolist.se@…
- Status changed from new to pending
comment:2 Changed 2 years ago by rwaldron
- Component changed from unfiled to effects
dmethvin, according to the docs, this wasn't supported. I wonder if the op meant to file as an enhancement?
comment:3 Changed 2 years ago by sciolist.se@…
- Status changed from pending to 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 2 years ago by threecreepio
demonstrates the issue, switch between 1.5 and 1.6 to see the difference.
comment:5 Changed 2 years ago by timmywil
- Priority changed from undecided to high
- Status changed from new to open
yea, this is supported
comment:6 Changed 2 years ago by threecreepio
there's a pull request for the issue: https://github.com/jquery/jquery/pull/369
comment:7 Changed 2 years ago by Daniel Pihlstrom
- Status changed from open to closed
- Resolution set to fixed
Fix per-property easing. Fixes #9067
Changeset: 3d1c27d52ec667cea5735366a41f65344ab17a5e
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Can you provide a test case? Was this a regression from a previous version?