Created
September 22, 2010 08:55
-
-
Save kyo-ago/591381 to your computer and use it in GitHub Desktop.
getScrollTop, getScrollLeftの設定
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* getScrollTop, getScrollLeftの設定 | |
* @returns scroll position | |
*/ | |
$.each([['Top', 'Y'], ['Left', 'X']], function () { | |
var name = this; | |
$[('getScroll' + name[0])] = function () { | |
var b = document.body['scroll' + name[0]] || 0; | |
var e = document.documentElement['scroll' + name[0]] || 0; | |
var s = window['scroll' + name[1]] || 0; | |
var p = window['page' + name[1] + 'Offset'] || 0; | |
return Math.max(b, e, s, p, 0); | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment