...
|
...
|
@@ -11,8 +11,12 @@ var info = require('./info'), |
|
|
setLazyLoadAndMellipsis = info.setLazyLoadAndMellipsis,
|
|
|
loadMore = info.loadMore;
|
|
|
|
|
|
var $loadMoreInfo = $('#load-more-info');
|
|
|
var $loading = $(''),
|
|
|
$noMore = $('');
|
|
|
|
|
|
var winH = $(window).height(),
|
|
|
loadMoreH = $('#load-more').height();
|
|
|
loadMoreH = $loadMoreInfo.height();
|
|
|
|
|
|
var $infoList = $('#info-list'),
|
|
|
$infos = $infoList.children('.info-list'),
|
...
|
...
|
@@ -24,6 +28,11 @@ var state = {}; |
|
|
|
|
|
var mySwiper;
|
|
|
|
|
|
if ($loadMoreInfo.length > 0) {
|
|
|
$loading = $loadMoreInfo.children('.loading');
|
|
|
$noMore = $loadMoreInfo.children('.no-more');
|
|
|
}
|
|
|
|
|
|
mySwiper = new Swiper('.swiper-container', {
|
|
|
lazyLoading: true,
|
|
|
pagination: '.swiper-pagination'
|
...
|
...
|
@@ -33,13 +42,16 @@ info.initInfosEvt($infoList); |
|
|
|
|
|
//初始化各Nav下资讯加载的状态
|
|
|
(function() {
|
|
|
var gender = $('#gender').val();
|
|
|
|
|
|
$nav.children('.guang-nav-item').each(function() {
|
|
|
var type = $(this).data('type');
|
|
|
|
|
|
state[type] = {
|
|
|
page: 1,
|
|
|
end: false,
|
|
|
type: type
|
|
|
gender: gender,
|
|
|
type: type,
|
|
|
end: false
|
|
|
};
|
|
|
});
|
|
|
}());
|
...
|
...
|
@@ -68,10 +80,19 @@ $nav.delegate('.guang-nav-item', 'touchstart', function() { |
|
|
|
|
|
$curNav = $this;
|
|
|
curType = $this.data('type');
|
|
|
|
|
|
//重置当前Tab的load-more
|
|
|
if (state[curType].end) {
|
|
|
$loading.addClass('hide');
|
|
|
$noMore.removeClass('hide');
|
|
|
} else {
|
|
|
$loading.removeClass('hide');
|
|
|
$noMore.addClass('hide');
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$(document).scroll(function() {
|
|
|
if ($(window).scrollTop() + winH >= $(document).height() - loadMoreH && !state[curType].end) {
|
|
|
if ($(window).scrollTop() + winH >= $(document).height() - loadMoreH) {
|
|
|
loadMore($infos, state[curType]);
|
|
|
}
|
|
|
}); |
|
|
\ No newline at end of file |
...
|
...
|
|