Authored by ccbikai

SALE 页面前端优化

... ... @@ -41,7 +41,9 @@
{{> common/floor-header}}
{{/floorHeader}}
{{> common/filter-nav}}
<div class="sale-nav-wrap">
{{> common/filter-nav}}
</div>
{{> product/sale/common}}
... ...
... ... @@ -29,13 +29,18 @@ $('.swiper-container').each(function() {
});
$(function() {
var $body = $('body');
var $saleNavSelect = $('.sale-nav-select');
var $vipFloor = $('.vip-floor');
var $saleNavWrap = $('.sale-nav-wrap');
var $listNav = $saleNavWrap.find('#list-nav');
$('.sale-nav').on('click', function() {
$saleNavSelect.toggleClass('show');
});
lazyload($('img.lazy'));
// 读取会员专享商品
$.ajax({
url: '/product/sale/search',
... ... @@ -53,4 +58,15 @@ $(function() {
lazyload($vipFloor.find('img.lazy'));
}
});
$saleNavWrap.css({
height: $saleNavWrap.height()
});
$(window).on('scroll', function() {
if ($body.scrollTop() > $saleNavWrap.offset().top) {
$listNav.addClass('fixed');
} else {
$listNav.removeClass('fixed');
}
}).trigger('scroll');
});
... ...
... ... @@ -98,6 +98,18 @@
display: none;
}
}
.list-nav {
width: 100%;
z-index: 1;
background: #fff;
&.fixed {
position: fixed;
top: 0;
left: 0;
}
}
}
.sale-vip-page {
... ...