Side navigation
#9067 closed bug (fixed)
Opened May 03, 2011 05:15PM UTC
Closed May 08, 2011 12:47AM UTC
.animate() array easing issue.
Reported by: | sciolist.se@gmail.com | Owned by: | sciolist.se@gmail.com |
---|---|---|---|
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.
Attachments (0)
Change History (7)
Changed May 03, 2011 07:00PM UTC by comment:1
owner: | → sciolist.se@gmail.com |
---|---|
status: | new → pending |
Changed May 03, 2011 07:03PM UTC by comment:2
component: | unfiled → effects |
---|
dmethvin, according to the docs, this wasn't supported. I wonder if the op meant to file as an enhancement?
Changed May 03, 2011 07:14PM UTC by comment:3
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.
Changed May 03, 2011 07:23PM UTC by comment:4
demonstrates the issue, switch between 1.5 and 1.6 to see the difference.
Changed May 03, 2011 07:27PM UTC by comment:5
priority: | undecided → high |
---|---|
status: | new → open |
yea, this is supported
Changed May 04, 2011 12:25AM UTC by comment:6
there's a pull request for the issue: https://github.com/jquery/jquery/pull/369
Can you provide a test case? Was this a regression from a previous version?