list.js 745 Bytes
/**
 * 逛首页,列表页,编辑页
 * @author: xuqi<qi.xu@yoho.cn>
 * @date: 2015/10/10
 */

var $ = require('yoho.zepto'),
    Swiper = require('yoho.iswiper');

var info = require('./info'),
    loadMore = info.loadMore;

var winH = $(window).height(),
    loadMoreH = $('#load-more').height();

var setting = {
    page: 1,
    end: false
};

var $infos = $('#info-list'),
    mySwiper;

info.initInfosEvt($infos);

mySwiper = new Swiper('.swiper-container', {
    lazyLoading: true,
    pagination: '.swiper-pagination'
});

$(document).scroll(function() {
    if (setting.end) {
        return;
    }

    if ($(window).scrollTop() + $(window).height() >= $(document).height() - loadMoreH) {
        loadMore($infos, setting);
    }
});