Opened 10 years ago
Closed 10 years ago
#13940 closed bug (duplicate)
Slide animation broken on jQuery 1.10.0 ?
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.10.0 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I just upgraded to jQuery 1.10.0 from 1.9.1 and found that this animation breaks on multiple browsers--it slides very fast and twitches in a strange way:
$(document).on('click','#my-btn',function(){
$('#my-div').show('slide', 250);
});
I'm using jQuery UI 1.10.3 in both the failing jQuery 1.10.0 and successful jQuery 1.9.1 cases.
Oddly enough, the hide('slide',250) works as normal.
Change History (5)
comment:3 Changed 10 years ago by
I trace the source code of 1.10.0 the problem is here: assume user's code is:
$('#slide3').animate({ left: '+=200' }, 500); or $('#slide3').animate({ left: '+=200px' }, 500);
in the 'tweeners[*] ' at line 8830 of the source code,at this point:
parts should be ['+=200','+','100',] or ['+=200','+','100','px'] then:
unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" )
jQuery.cssNumber[ prop ] eqs jQuery.cssNumber[ 'left' ], the value === null
so: unit ==="px"
start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) && rfxnum.exec( jQuery.css( tween.elem, prop ) )
then unit!=="px" always ===false
so: start=false
//line 8870 tween.end = parts[ 1 ] ?start + ( parts[ 1 ] + 1 ) * parts[ 2 ] : +parts[ 2 ];
because start=false ,start+(parts[1]+1)*parts[2] = false+ +1*200= 200
so:tween.end=200
but it should be 0;
Sorry for my poor English.
comment:4 Changed 10 years ago by
I double that, and want to point that is same bug exists in 2.0.1 as well. Really stops from upgrading...
Yes,the same issue here
a simple demo on jsFiddle change jquery version 1.10 to 1.9.1 to see the difference... http://jsfiddle.net/niphor/53Dxj/
2.0.1 also have the same issue.