|
|
var $ = require('jquery'),
|
|
|
Hammer = require('yoho.hammer');
|
|
|
|
|
|
Swiper = require('yoho.iswiper'),
|
|
|
lazyLoad = require('yoho.lazyload');
|
|
|
Hammer = require('yoho.hammer'),
|
|
|
Swiper = require('yoho.iswiper'),
|
|
|
lazyLoad = require('yoho.lazyload');
|
|
|
|
|
|
var page = 1,
|
|
|
winH,
|
|
|
hotnav,
|
|
|
listTop,
|
|
|
navSwiper,
|
|
|
notab=0,
|
|
|
sort = '',
|
|
|
id = '';
|
|
|
|
|
|
function hotrank(page, sort, tab_id) {
|
|
|
function hotrank(page, sort, tabId, notab) {
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/product/newsale/selectHotrank',
|
...
|
...
|
@@ -18,15 +20,22 @@ function hotrank(page, sort, tab_id) { |
|
|
data: {
|
|
|
page: page,
|
|
|
sort: sort,
|
|
|
tab_id: tab_id
|
|
|
tab_id: tabId,
|
|
|
notab: notab
|
|
|
},
|
|
|
success: function(data) {
|
|
|
if (page === 1) {
|
|
|
$('#hotRank').html('');
|
|
|
$('.rank-main').html('');
|
|
|
}
|
|
|
console.log(notab);
|
|
|
if (notab === 1) {
|
|
|
$('.rank-main').append(data);
|
|
|
} else {
|
|
|
$('#hotRank').append(data);
|
|
|
}
|
|
|
$('#hotRank').append(data);
|
|
|
lazyLoad($('img.lazy'));
|
|
|
$('#yoho-footer').css('position', 'static');
|
|
|
$('.rank-main ul li:gt(2)').find('.item-content i').removeClass('top');
|
|
|
navSwiper = new Swiper('.s-goods-nav', {
|
|
|
grabCursor: true,
|
|
|
slidesPerView: 'auto',
|
...
|
...
|
@@ -38,9 +47,12 @@ function hotrank(page, sort, tab_id) { |
|
|
$('.s-goods-nav .nav-item').each(function(index) {
|
|
|
hotnav = new Hammer($('.s-goods-nav .nav-item')[index]);
|
|
|
hotnav.on('tap', function(e) {
|
|
|
id = $('.s-goods-nav .nav-item').eq(index).data('id'),
|
|
|
sort = parseInt($('.s-goods-nav .nav-item').eq(index).data('sort').split('=')[1]);
|
|
|
hotrank(page, sort, id);
|
|
|
var navItme = $('.s-goods-nav .nav-item').eq(index);
|
|
|
|
|
|
id = navItme.data('id') ? navItme.data('id') : '';
|
|
|
page = 1;
|
|
|
notab = 1;
|
|
|
hotrank(page, sort, id, notab);
|
|
|
});
|
|
|
});
|
|
|
}
|
...
|
...
|
@@ -55,7 +67,8 @@ $(window).scroll(function () { |
|
|
return;
|
|
|
}
|
|
|
page = 2;
|
|
|
hotrank(page, sort, id);
|
|
|
notab = 1;
|
|
|
hotrank(page, sort, id, notab);
|
|
|
|
|
|
});
|
|
|
hotrank(page, sort, id); |
|
|
hotrank(page, sort, id, notab); |
...
|
...
|
|