...
|
...
|
@@ -16,3 +16,53 @@ require('./product'); |
|
|
|
|
|
//最近浏览的商品Lazyload
|
|
|
lazyLoad($('.latest-walk .lazy'));
|
|
|
|
|
|
(function() {
|
|
|
var $brands = $('.brands');
|
|
|
|
|
|
var wrapWidth,
|
|
|
$firstBrand,
|
|
|
totalWidth,
|
|
|
perWidth;
|
|
|
|
|
|
if ($brands.length === 0) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
wrapWidth = $('.brands-wrap').width();
|
|
|
|
|
|
$firstBrand = $brands.children('li:first-child');
|
|
|
perWidth = $firstBrand.width() + $firstBrand.css('margin-left').replace('px', '') * 1;
|
|
|
|
|
|
totalWidth = perWidth * $brands.children('li').length;
|
|
|
|
|
|
//针对NEW页面Header的brand banner切换
|
|
|
$('.new-brands').on('click', '.pre,.next', function() {
|
|
|
var $this = $(this),
|
|
|
left;
|
|
|
|
|
|
left = $brands.css('left');
|
|
|
|
|
|
if (left === 'auto') {
|
|
|
left = 0;
|
|
|
} else {
|
|
|
left = +left.replace('px', '');
|
|
|
}
|
|
|
|
|
|
if (($this).hasClass('pre')) {
|
|
|
|
|
|
//左边界
|
|
|
if (left + wrapWidth > 0) {
|
|
|
return;
|
|
|
}
|
|
|
$brands.css('left', left + wrapWidth + 'px');
|
|
|
} else {
|
|
|
|
|
|
//右边界
|
|
|
if (left - wrapWidth < -totalWidth) {
|
|
|
return;
|
|
|
}
|
|
|
$brands.css('left', left - wrapWidth + 'px');
|
|
|
}
|
|
|
});
|
|
|
}()); |
|
|
\ No newline at end of file |
...
|
...
|
|