Commit b78e3fc3 authored by Xavi's avatar Xavi

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

parent bed64e65
...@@ -263,34 +263,34 @@ jQuery.each( ["Left", "Top"], function( i, name ) { ...@@ -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(
!i ? val : jQuery(win).scrollLeft(),
i ? val : jQuery(win).scrollTop()
);
} else {
this[ method ] = val;
}
});
}
elem = this[0]; win = getWindow( elem );
if( !elem ) { // Return the scroll offset
return null; 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 ); // Set the scroll offset
// Return the scroll offset return this.each(function() {
return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] : win = getWindow( this );
jQuery.support.boxModel && win.document.documentElement[ method ] ||
win.document.body[ method ] : if ( win ) {
elem[ method ]; win.scrollTo(
!i ? val : jQuery(win).scrollLeft(),
i ? val : jQuery(win).scrollTop()
);
} else {
this[ method ] = val;
}
});
}; };
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment