Authored by 梁志锋

品牌一览支持轮播和品牌手滑的样式调整,以及商品详情页的touchend改成hammer手势 code review by zhangzheng

... ... @@ -11,8 +11,9 @@ var $ = require('jquery'),
var swiper,
$fixTitleBar,
$brandList = $('.brand-list');
var $icon = $('.search-icon');
$brandList = $('.brand-list'),
$icon = $('.search-icon'),
hotBrandsSwiper;
var searchH = $('.newbrand-search').outerHeight(),
headerH = $('.yoho-header').outerHeight(),
... ... @@ -23,6 +24,14 @@ var brandsData,
$keyword,
clearTextHammer;
//热门品牌滑动
hotBrandsSwiper = new Swiper('.brands-swiper', {
grabCursor: true,
slidesPerView: 'auto',
wrapperClass: 'brands-list',
slideElement: 'li'
});
swiper = new Swiper('.swiper-container', {
lazyLoading: true,
loop: true,
... ... @@ -37,12 +46,16 @@ $('.yoho-header').css({
top: 0
});
if ($('.banner-top').length > 0) {
$('.hot-brands').css('padding-top', '0');
}
$fixTitleBar = $('<div class="title-bar fixed-title-bar"><h2></h2></div>');
$fixTitleBar.css({
position: 'fixed',
top: brandSwipe
}).hide();
minBrandListTop = brandSwipe + $('.hot-brand').outerHeight() + $('.banner-top').outerHeight();
minBrandListTop = brandSwipe + $('.hot-brands').outerHeight() + $('.banner-top').outerHeight();
$brandList.last().append($fixTitleBar);
function scrollHandler() {
... ...
... ... @@ -5,12 +5,14 @@
*/
var $ = require('jquery'),
Swiper = require('yoho.iswiper'),
Hammer = require('yoho.hammer'),
lazyLoad = require('yoho.lazyload');
var goodsSwiper,
$discountFolder = $('.goodsDiscount .discount-folder'),
$discountArrow = $('.goodsDiscount .first-item span');
var goodsDiscountHammer = new Hammer(document.getElementById('goodsDiscount'));
require('./desc');
require('./comments-consults');
... ... @@ -38,7 +40,7 @@ if (0 === $('.goodsDiscount .discount-folder').children().length) {
}
//goods-discount下拉按钮点击事件
$('.goodsDiscount').on('touchend', function(e) {
goodsDiscountHammer.on('tap', function(e) {
if ($discountFolder.is(':hidden')) {
$discountArrow.removeClass('icon-down').addClass('icon-up').html('&#xe608;');
$discountFolder.slideDown();
... ... @@ -46,7 +48,7 @@ $('.goodsDiscount').on('touchend', function(e) {
$discountArrow.removeClass('icon-up').addClass('icon-down').html('&#xe609;');
$discountFolder.slideUp();
}
return false;
});
require('./like');
... ...
... ... @@ -75,6 +75,10 @@
background-color:#f8f8f8;
}
.hot-brands {
padding-top: 178rem / $pxConvertRem;
}
.hot-brand {
margin: (30rem / $pxConvertRem) 0 0;
... ...
... ... @@ -64,7 +64,7 @@
{{/vipLevel}}
{{# goodsDiscount}}
<div class="goodsDiscount">
<div class="goodsDiscount" id="goodsDiscount">
{{# list}}
{{#if @first}}
{{#if text}}
... ...