Created
May 25, 2012 07:22
-
-
Save lyuehh/2786388 to your computer and use it in GitHub Desktop.
scroll in ie
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
scroll: function(start, end) { // 是否在滚动的标志位 | |
var _scroll = false; // 初始化获取滚动的高度 | |
var _top = $(document).scrollTop(); // 监听滚动是否开始结束 | |
var _scroll = setInterval(function() { | |
var __top = $(document).scrollTop(); | |
if (!_scroll && _top != __top) { // 滚动开始 | |
_scroll = true; | |
if (typeof start == 'function') start(); | |
} | |
if (_scroll && _top == __top) { | |
_scroll = false; | |
if (typeof end == 'function') end(); | |
} | |
_top = __top; | |
}, 100); // 采用bind滚动的方式 | |
$(window).bind('scroll', function(e) { // alert('scrolling...'); | |
if (!_scroll) { // alert('scroll...'); | |
start(); | |
_scroll = true; | |
} | |
}); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment