my-guang.js 674 Bytes
/**
 * 我的逛
 * @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);

    $(window).scroll(function() {
        window.requestAnimationFrame(scrollHandler);
    });
}