Authored by zhangxiaoru

shop nav

... ... @@ -189,6 +189,8 @@ function shopNavData() {
navList: data
});
var tabNum;
if (data === false) {
shopListData('null');
$('.shop-nav').hide();
... ... @@ -198,12 +200,7 @@ function shopNavData() {
$('.shop-area').html(navString);
// 导航滑动效果
navSwiper = new Swiper('.shop-area', {
grabCursor: true,
slidesPerView: 'auto',
slideElement: 'li'
});
// 加载第一页数据
if (navType.id) {
... ... @@ -211,6 +208,7 @@ function shopNavData() {
if (decodeURI(navType.id) === $(this).data('type')) {
$(this).addClass('active');
shopListData($(this).data('type'));
tabNum = $(this).index();
}
});
} else {
... ... @@ -218,6 +216,20 @@ function shopNavData() {
shopListData($('.shop-nav').find('li').eq(0).data('type'));
}
// 导航滑动效果
navSwiper = new Swiper('.shop-area', {
grabCursor: true,
slidesPerView: 'auto',
initialSlide: tabNum,
slideElement: 'li'
});
if (tabNum < 3) {
$('.shop-area ul').css({
transform: 'translateX(0px)'
});
}
$(window).on('scroll touchmove touchstart touchend', function() {
if ($(window).scrollTop() > $('.shop-nav')[0].offsetTop) {
$('.shop-area').addClass('fixer');
... ...