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

var $ = require('jquery');

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

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

var $author = $('#author-infos');
var $tag = $('#tag');

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

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

info.initInfosEvt($infos);

if ($author.length > 0) {
    $.extend(setting, {
        authorId: $author.data('id')
    });
}

if ($tag.length > 0) {
    $.extend(setting, {
        tag: $tag.val()
    });
}

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