mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Bug 7931; Inverted logic in scrollTop/Left (i.e. made
This commit is contained in:
parent
bed64e65cc
commit
b78e3fc39f
@ -263,7 +263,20 @@ 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) {
|
||||||
|
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 ];
|
||||||
|
}
|
||||||
|
|
||||||
// Set the scroll offset
|
// Set the scroll offset
|
||||||
return this.each(function() {
|
return this.each(function() {
|
||||||
win = getWindow( this );
|
win = getWindow( this );
|
||||||
@ -278,19 +291,6 @@ jQuery.each( ["Left", "Top"], function( i, name ) {
|
|||||||
this[ method ] = val;
|
this[ method ] = val;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
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 ];
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user