...
|
...
|
@@ -7,6 +7,17 @@ var $curNav, |
|
|
$newArrivalList = $('#newarrival-goods-list'),
|
|
|
$goods = $newArrivalList.children('.goods-list');
|
|
|
|
|
|
var winH = $(window).height(),
|
|
|
loadMoreH = $('#load-more').height(),
|
|
|
$goodList = $('.goods-list'),
|
|
|
loading = false,
|
|
|
end = false,
|
|
|
page = 0,
|
|
|
index = 0,
|
|
|
num,
|
|
|
url,
|
|
|
res;
|
|
|
|
|
|
var swiper;
|
|
|
|
|
|
swiper = new Swiper('.swiper-container', {
|
...
|
...
|
@@ -19,8 +30,8 @@ $curNav = $navList.children('.focus'); |
|
|
|
|
|
$('#newarrival-nav').delegate('li', 'touchstart', function() {
|
|
|
var $this = $(this),
|
|
|
$content,
|
|
|
index;
|
|
|
$content;
|
|
|
|
|
|
|
|
|
if ($this.hasClass('focus')) {
|
|
|
return;
|
...
|
...
|
@@ -38,4 +49,46 @@ $('#newarrival-nav').delegate('li', 'touchstart', function() { |
|
|
$curNav = $this;
|
|
|
|
|
|
$(document).trigger('scroll'); //Trigger lazyLoad
|
|
|
});
|
|
|
|
|
|
//srcoll to load more
|
|
|
$(window).scroll(function () {
|
|
|
if ($(window).scrollTop() + winH >= $(document).height() - loadMoreH) {
|
|
|
if (loading) {
|
|
|
return;
|
|
|
}
|
|
|
loading = true;
|
|
|
num = $goodList.children('.good-info').length;
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
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
|
|
|
//lazyLoad($goodList.children('.good-info:gt(' + (num - 1) + ')').find('img.lazy'));
|
|
|
lazyLoad($('.good-info').find('img.lazy'));
|
|
|
|
|
|
loading = false;
|
|
|
page++;
|
|
|
},
|
|
|
error: function() {
|
|
|
tip.show('网络断开连接了~');
|
|
|
loading = false;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
}); |
|
|
\ No newline at end of file |
...
|
...
|
|