Skip to content
Permalink
Browse files

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

  • Loading branch information...
xavi- committed Jan 10, 2011
1 parent bed64e6 commit b78e3fc39f96d63a60ea66e3d066815626e633d8
Showing with 25 additions and 25 deletions.
  1. +25 −25 src/offset.js
@@ -263,34 +263,34 @@ jQuery.each( ["Left", "Top"], function( i, name ) {
jQuery.fn[ method ] = function(val) {
var elem, win;

if ( val !== undefined ) {
// Set the scroll offset
return this.each(function() {
win = getWindow( this );

if ( win ) {
win.scrollTo(
!i ? val : jQuery(win).scrollLeft(),
i ? val : jQuery(win).scrollTop()
);

} else {
this[ method ] = val;
}
});
}
if(val === undefined) {
elem = this[0];
if( !elem ) {
return null;
}

elem = this[0];
if( !elem ) {
return null;
win = getWindow( elem );
// Return the scroll offset
return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] :
jQuery.support.boxModel && win.document.documentElement[ method ] ||
win.document.body[ method ] :
elem[ method ];
}

win = getWindow( elem );
// Return the scroll offset
return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] :
jQuery.support.boxModel && win.document.documentElement[ method ] ||
win.document.body[ method ] :
elem[ method ];
// Set the scroll offset
return this.each(function() {
win = getWindow( this );

if ( win ) {
win.scrollTo(
!i ? val : jQuery(win).scrollLeft(),
i ? val : jQuery(win).scrollTop()
);

} else {
this[ method ] = val;
}
});
};
});

0 comments on commit b78e3fc

Please sign in to comment.
You can’t perform that action at this time.