|
|
var $ = require('yoho.zepto'),
|
|
|
tip = require('../../plugin/tip'),
|
|
|
Swiper = require('yoho.iswiper'),
|
|
|
lazyLoad = require('yoho.zeptolazyload');
|
|
|
|
...
|
...
|
@@ -11,12 +12,9 @@ var winH = $(window).height(), |
|
|
loadMoreH = $('#load-more').height(),
|
|
|
$goodList = $('.goods-list'),
|
|
|
loading = false,
|
|
|
end = false,
|
|
|
page = 0,
|
|
|
index = 0,
|
|
|
num,
|
|
|
url,
|
|
|
res;
|
|
|
num;
|
|
|
|
|
|
var swiper;
|
|
|
|
...
|
...
|
@@ -31,7 +29,7 @@ $curNav = $navList.children('.focus'); |
|
|
$('#newarrival-nav').delegate('li', 'touchstart', function() {
|
|
|
var $this = $(this),
|
|
|
$content;
|
|
|
|
|
|
|
|
|
|
|
|
if ($this.hasClass('focus')) {
|
|
|
return;
|
...
|
...
|
@@ -55,26 +53,24 @@ $('#newarrival-nav').delegate('li', 'touchstart', function() { |
|
|
$(window).scroll(function () {
|
|
|
if ($(window).scrollTop() + winH >= $(document).height() - loadMoreH) {
|
|
|
if (loading) {
|
|
|
return;
|
|
|
return;
|
|
|
}
|
|
|
loading = true;
|
|
|
num = $goodList.children('.good-info').length;
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/product/newsale/selectNewSale?dayLimit'+(index+1),
|
|
|
url: '/product/newsale/selectNewSale?dayLimit' + (index + 1),
|
|
|
data: {
|
|
|
page: page + 1
|
|
|
},
|
|
|
success: function(data) {
|
|
|
if (data === ' ') {
|
|
|
|
|
|
//opt.end = true;
|
|
|
loading = false;
|
|
|
|
|
|
$loading.addClass('hide');
|
|
|
$noMore.removeClass('hide');
|
|
|
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$goodList.append(data);
|
|
|
|
|
|
//lazyLoad
|
...
|
...
|
@@ -82,7 +78,7 @@ $(window).scroll(function () { |
|
|
lazyLoad($('.good-info').find('img.lazy'));
|
|
|
|
|
|
loading = false;
|
|
|
page++;
|
|
|
page++;
|
|
|
},
|
|
|
error: function() {
|
|
|
tip.show('网络断开连接了~');
|
...
|
...
|
|