Skip to content

Commit

Permalink
Fix #12846. Restore overflow when animation is stopped.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmethvin committed Jan 27, 2013
1 parent b594673 commit a6c358d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/effects.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ function defaultPrefilter( elem, props, opts ) {

if ( opts.overflow ) {
style.overflow = "hidden";
anim.done(function() {
anim.always(function() {
style.overflow = opts.overflow[ 0 ];
style.overflowX = opts.overflow[ 1 ];
style.overflowY = opts.overflow[ 2 ];
Expand Down
6 changes: 4 additions & 2 deletions test/unit/effects.js
Original file line number Diff line number Diff line change
Expand Up @@ -1758,16 +1758,18 @@ asyncTest("Animation callbacks (#11797)", 15, function() {
});
});

test( "Animate properly sets overflow hidden when animating width/height (#12117)", 4, function() {
test( "Animate properly sets overflow hidden when animating width/height (#12117)", 8, function() {
jQuery.each( [ "height", "width" ], function( _, prop ) {
jQuery.each( [ 100, 0 ], function( _, value ) {
var div = jQuery("<div>"),
var div = jQuery("<div>").css( "overflow", "auto" ),
props = {};
props[ prop ] = value;
div.animate( props, 1 );
equal( div.css( "overflow" ), "hidden",
"overflow: hidden set when animating " + prop + " to " + value );
div.stop();
equal( div.css( "overflow" ), "auto",
"overflow: auto restored after animating " + prop + " to " + value );
});
});
});
Expand Down

0 comments on commit a6c358d

Please sign in to comment.