my-guang.js
704 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* 我的逛
* @author xuqi<qi.xu@yoho.cn>
* @date: 2015/11/17
*/
var $ = require('jquery');
var $infoList = $('#info-list');
var winH = $(window).height();
var info = require('../guang/info'),
loadMore = info.loadMore;
var setting = {
page: 2,
end: false
};
function scrollHandler() {
if ($(window).scrollTop() + winH >= $(document).height() - 0.25 * $infoList.height()) {
loadMore($infoList, setting, '/home/myguang');
}
}
//对于有逛收藏的页面进行事件处理
if ($infoList.length > 0) {
info.initInfosEvt($infoList);
//srcoll to load more
$(window).scroll(function() {
window.requestAnimationFrame(scrollHandler);
});
}