Side navigation
#7287 closed bug (duplicate)
Opened October 22, 2010 02:25PM UTC
Closed October 22, 2010 07:44PM UTC
Last modified March 14, 2012 02:17AM UTC
-10000px bug for jQuery.animate
Reported by: | yuxel@sonsuzdongu.com | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | 1.5 |
Component: | effects | Version: | 1.4.3 |
Keywords: | -10000px bug animate | Cc: | |
Blocked by: | Blocking: |
Description
Hi,
First of all thansk for building jQuery.
I'm trying to make an animation using .animate. But when I try to move to "margin-left","-10000px" it starts animating from first pixel or lets say I'm seeing content of first pixels.
You can try it from here : http://gist.github.com/640615
When margin-left set less than -10000px i'm seeing "TextTextText", but when I try it over -10000 such as -9999 it works fine.
Attachments (0)
Change History (21)
Changed October 22, 2010 04:55PM UTC by comment:1
keywords: | → -10000px bug animate |
---|---|
resolution: | → worksforme |
status: | new → closed |
Changed October 22, 2010 07:06PM UTC by comment:2
I have this exact same bug. I have a list of horizontal images that I scroll through. Once I set the margin-left less than -10,000px it animates the list from the first picture to the next as described by the poster.
I can't give a link to see this since its on my development branch.
Changed October 22, 2010 07:44PM UTC by comment:3
resolution: | worksforme |
---|---|
status: | closed → reopened |
Changed October 22, 2010 07:44PM UTC by comment:4
resolution: | → duplicate |
---|---|
status: | reopened → closed |
Changed November 01, 2010 07:52PM UTC by comment:6
+1
Have the exact same bug. Only happens on -10,000px and behaves exactly as original poster describes
Changed November 19, 2010 12:32PM UTC by comment:7
Same bug here. above -10 000, animations ignore the current value that must be animated and start from 0 instead.
Changed November 23, 2010 11:08PM UTC by comment:8
I have the very same issue, using the relative syntax (fx: { left : '+=1000' }) performs a little better but also doesn't produce expected results. really a showstopper
Changed December 01, 2010 11:26AM UTC by comment:9
+1
It also happens with 1.4.4
Changed December 01, 2010 11:59AM UTC by comment:10
I know how to fix it but I don't understand what I'm doing exactly, so maybe someone can help.
Get the uncompressed jQuery, look at line 6624:
return r && r > -10000 ? r : 0;
Does that mean it returns 0 if larger than -10000 or something?
It's part of the "cur function()" ("Get the current size" says its comment) and this function is used inside the animate function in line 6472:
start = e.cur() || 0;
I needed a quick fix, so I changed
return r && r > -10000 ? r : 0;
to
return r && r > -1000000 ? r : 0;
and this seems to work for now.
Changed December 17, 2010 03:08PM UTC by comment:11
Huge bug. This takes a half a second to fix so that we don't have to hack our own development versions and won't be able to upgrade to future versions automatically (we'll have to fix the bug first and then re-minify the new version of the library).
To the dev team, please, it takes a half a second to add the extra 0 that Tom pointed out. Fix the library and put out 1.4.4.1!!!!
Changed January 05, 2011 10:42AM UTC by comment:12
I confirm the bug in 1.4.4
Tom's fix works fine.
Changed January 05, 2011 02:50PM UTC by comment:13
Not only is this bug a duplicate, but it has now been fixed.
https://github.com/jquery/jquery/commit/4eeae8b0bc789ad525e98568cffb37b04b27ae84
Changed January 09, 2011 06:46PM UTC by comment:14
Does anybody know when the google version will have this update applied to it?
Changed January 09, 2011 07:43PM UTC by comment:15
Once the next version of jQuery is released.
Changed January 10, 2011 01:14PM UTC by comment:16
component: | unfiled → effects |
---|---|
priority: | undecided → low |
Changed January 13, 2011 06:33PM UTC by comment:17
Hey everybody. If / until the this bug gets fixed, a better way to completely remove the limit is to overwrite the function ''in a different file''. That way, when the next version of jquery comes out, you don't risk overwriting you change and breaking the code. My buddy Andy at work helped me write this code, so if you need to have the -10000 pixel limit completely removed, use this code.
$.fx.prototype.cur = function(){ // we are overwriting this function to remove limiting of the size of the if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) { return this.elem[ this.prop ]; } var r = parseFloat( jQuery.css( this.elem, this.prop ) ); return typeof r == 'undefined' ? 0 : r; }
Changed January 24, 2011 01:14PM UTC by comment:18
Hi, I found temporary solution before we get the next release.
We can use minified version of 1.4.4, find and replace this code:
return a&&a>-1E4?a:0
with
return a||0
Changed January 25, 2011 01:41PM UTC by comment:19
In the minified version they use exponential notation, so replace this code:
return a&&a>-1E4?a:0
with this:
return a?a:0
Changed January 25, 2011 01:42PM UTC by comment:20
Sorry just saw this was already posted!
Changed February 16, 2011 10:35AM UTC by comment:21
This bug as been fixed i belive.. i no longer have this problem since jQuery 1.5
Your code is working fine for me in Safari and Firefox. By the looks of it this may actually be more of an implementation bug in what you're trying to achieve in your code than a discernible jQuery core issue. If you could kindly submit your request for assistance/review over at the jQuery forums, another member of our team would be happy to assist.