Bug 7931; Inverted logic in scrollTop/Left (i.e. made

This commit is contained in:
Xavi 2011-01-09 20:51:20 -05:00
parent bed64e65cc
commit b78e3fc39f

View file

@ -263,34 +263,34 @@ jQuery.each( ["Left", "Top"], function( i, name ) {
jQuery.fn[ method ] = function(val) { jQuery.fn[ method ] = function(val) {
var elem, win; var elem, win;
if ( val !== undefined ) { if(val === undefined) {
// Set the scroll offset elem = this[0];
return this.each(function() { if( !elem ) {
win = getWindow( this ); return null;
}
if ( win ) {
win.scrollTo( win = getWindow( elem );
!i ? val : jQuery(win).scrollLeft(), // Return the scroll offset
i ? val : jQuery(win).scrollTop() return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] :
); jQuery.support.boxModel && win.document.documentElement[ method ] ||
win.document.body[ method ] :
} else { elem[ method ];
this[ method ] = val;
}
});
} }
elem = this[0]; // Set the scroll offset
if( !elem ) { return this.each(function() {
return null; win = getWindow( this );
}
if ( win ) {
win = getWindow( elem ); win.scrollTo(
// Return the scroll offset !i ? val : jQuery(win).scrollLeft(),
return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] : i ? val : jQuery(win).scrollTop()
jQuery.support.boxModel && win.document.documentElement[ method ] || );
win.document.body[ method ] :
elem[ method ]; } else {
this[ method ] = val;
}
});
}; };
}); });