Ticket #7193 (closed bug: fixed)
$.fn.animate cannot "start" from any value less than -10000
| Reported by: | tdreyno@… | Owned by: | john |
|---|---|---|---|
| Priority: | low | Milestone: | 1.5 |
| Component: | effects | Version: | 1.4.3 |
| Keywords: | Cc: | john | |
| Blocking: | Blocked by: |
Description
On line 6347: return r && r > -10000 ? r : 0;
Essentially, the default start value of an animation can be as low as -10000, otherwise it resets to 0.
I'm using a very long scrollable area (about 15000px), when I slide from -9000px to near the end (say -14000px) it resets to 0 and animated from 0->-14000px, rather than -9000px->-14000px.
Is there a reason for this arbitrary limit?
Change History
comment:2 Changed 3 years ago by snover
- Cc john added
- Priority changed from undecided to low
- Status changed from new to open
- Component changed from unfiled to effects
- Milestone changed from 1.4.3 to 1.next
Good question.
comment:3 Changed 3 years ago by jitter
This isn't much of a help but might serve as a starting point.
The limit was introduced in August 2006 Relevant Commit to apparently fix something in Opera (at that time approx. Opera 9.00 was the current version)
For me your test-case doesn't fail but thats because jQuery 1.4.2 is used.
Here I provide the same test-case again but this time with jQuery 1.4.3rc2 used and the animation fails
http://jsbin.com/ewulu/3 (source view: http://jsbin.com/ewulu/3/edit)
comment:4 Changed 3 years ago by snover
- Milestone changed from 1.4.4 to 1.4.5
Retargeting due to severity of regressions in 1.4.3.
comment:6 Changed 3 years ago by john
- Owner set to john
- Status changed from open to assigned
- Milestone changed from 1.4.5 to 1.4.4
comment:7 Changed 3 years ago by snover
- Milestone changed from 1.4.4 to 1.4.5
Retargeting to next minor release.
comment:10 follow-up: ↓ 17 Changed 3 years ago by lazahu@…
Here's a heuristic fix for the bug.
Change line 6624 from:
return r && r > -10000 ? r : 0;
to:
return r;
Tested for this particular problem in FF 3.6.12, Chrome 7.0.517.44, IE 8.0.7600.16385, Safari 5.0.2 and Opera 10.63.3516. Works like expected.
comment:11 Changed 3 years ago by anonymous
Sorry, I'm totally dumb, haven't noticed it's been found already. You can remove my comments.
comment:12 Changed 3 years ago by jitter
#7532 is a duplicate of this ticket.
comment:13 Changed 3 years ago by lazahu@…
Just another test case to fiddle with: http://jsfiddle.net/mwJkJ/
comment:14 Changed 3 years ago by snover
3rd party pull request
comment:15 Changed 3 years ago by anonymous
I've implemented
return r /*&& r > -10000 ? r : 0*/;
and look forward to a fix in a future release
comment:16 Changed 2 years ago by rwaldron
#7625 is a duplicate of this ticket.
comment:17 in reply to: ↑ 10 Changed 2 years ago by daniel.baulig@…
Replying to lazahu@…:
Change line 6624 from:
return r && r > -10000 ? r : 0;to:
return r;Tested for this particular problem in FF 3.6.12, Chrome 7.0.517.44, IE 8.0.7600.16385, Safari 5.0.2 and Opera 10.63.3516. Works like expected.
I suggest reducing the amount of changed code by only removing the cause of the problem and not the additional validity check by using the following code:
return r ? r : 0;
or
return r || 0;
The check if r is true-ish is in no way related to this bug and should be kept in place in case it breaks something else.
comment:18 Changed 2 years ago by jitter
#7657 is a duplicate of this ticket.
comment:19 Changed 2 years ago by jitter
#7760 is a duplicate of this ticket.
comment:20 Changed 2 years ago by jitter
#7801 is a duplicate of this ticket.
comment:21 Changed 2 years ago by anonymous
Great, got it fixed as daniel.baulig and lazahu suggested, thanks. It kept me up whole night yesterday
comment:22 Changed 2 years ago by anonymous
Hacking the core as described unfortunately is no solution for distributed packages.
This bug doesn't even show up in the change log for jQuery 1.5, does that mean it hasn't been fixed (yet?) in the future version? Some details from one of the developers would be greatly appreciated!
comment:23 Changed 2 years ago by dmethvin
#7859 is a duplicate of this ticket.
comment:24 Changed 2 years ago by ajpiano
To which jQuery 1.5 changelog do you refer? There is not an official jQuery 1.5 changelog yet, because there is no jQuery 1.5 yet. If you're referring to the changelog in the recent community updates post, that is just a log of changes that have happened thus far, it is not a complete changelog.
When the bug is fixed, this ticket will be closed. It is certainly something we are planning to address for 1.5 - otherwise we'll be getting dupes on this issue until the end of time. :)
comment:25 Changed 2 years ago by Colin Snover
- Status changed from assigned to closed
- Resolution set to fixed
Remove patch for very early versions of Opera 9 that made it impossible to animate values smaller than -10000. Fixes #7193. Thanks to igorw for initial patch & test case.
Changeset: 4eeae8b0bc789ad525e98568cffb37b04b27ae84
comment:27 Changed 2 years ago by jitter
#7935 is a duplicate of this ticket.
comment:28 Changed 2 years ago by jitter
#8341 is a duplicate of this ticket.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

JSfiddle example... but jsfiddle doesn't have 1.4.3rc
Basically, you should never see red again after is scrolls offscreen the first time:
http://jsfiddle.net/uMeHf/1/