Authored by Lynnic

code viewed by liangzhifeng

... ... @@ -16,7 +16,9 @@ var consultFooterEle = document.getElementById('consult-content-footer'),
navtabHammer = navtabEle && new Hammer(navtabEle),
gotoConsultEle = document.getElementById('goto-consult'),
gotoConsultHammer = gotoConsultEle && new Hammer(gotoConsultEle);
gotoConsultHammer = gotoConsultEle && new Hammer(gotoConsultEle),
$gotoConsult = $('#goto-consult');
... ... @@ -77,4 +79,22 @@ if (gotoConsultHammer) {
gotoConsultHammer.on('tap', function() {
location.href = $(gotoConsultEle).find('a').attr('href');
});
}
\ No newline at end of file
}
function fixConsultBar() {
if ($(window).scrollTop() > $('#yoho-header').outerHeight()) {
$gotoConsult.css('position', 'fixed');
$gotoConsult.css('top', '0');
} else {
$gotoConsult.css('position', 'static');
}
}
//滚动时顶部固定 我要咨询
function scrollHandler() {
fixConsultBar();
}
$(window).scroll(function() {
window.requestAnimationFrame(scrollHandler);
});
... ...
... ... @@ -15,7 +15,10 @@ var goodsSwiper,
var goodsDiscountEl = document.getElementById('goodsDiscount'),
goodsDiscountHammer = goodsDiscountEl && new Hammer(goodsDiscountEl);
var $cart = $('.cart-bar');
var $cart = $('.cart-bar'),
$goodsSubtitle = $('.goodsSubtitle'),
divH,
$goodsSubtitleSpan;
require('./desc');
require('./comments-consults');
... ... @@ -82,4 +85,12 @@ $.ajax({
}
});
//限制goodsSubtitle为两行
if ($goodsSubtitle[0]) {
divH = $goodsSubtitle.height();
$goodsSubtitleSpan = $goodsSubtitle.find('span');
while ($goodsSubtitleSpan.outerHeight() > divH) {
$goodsSubtitleSpan.text($goodsSubtitleSpan.text().replace(/(\s)*([a-zA-Z0-9]+|\W)(\.\.\.)?$/, '...'));
}
}
require('./like');
... ...
... ... @@ -41,6 +41,8 @@
.goods-consults-page {
background-color: #f0f0f0;
.goto-consult {
width: 100%;
box-sizing:border-box;
padding: 0 pxToRem(28px);
height: pxToRem(120px);
background-color: #ffffff;
... ...
... ... @@ -211,14 +211,19 @@ $basicBtnC:#eb0313;
background-color: #515150;
}
.goodsSubtitle {
min-height: pxToRem(87px);
height: pxToRem(88px);
font-size: pxToRem(24px);
line-height: pxToRem(36px);
color: $subFontC;
padding-left: pxToRem(28px);
padding-right: pxToRem(28px);
padding-top: pxToRem(14px);
border-bottom: 1px solid $borderC;
background-color: #f4f4f4;
span{
display: block;
line-height: pxToRem(36px);
margin: 0;
}
}
.price-date {
// width: 100%;
... ... @@ -253,8 +258,7 @@ $basicBtnC:#eb0313;
line-height: pxToRem(88px);
}
}
.goodsName,
.goodsSubtitle {
.goodsName {
// width: 100%;
display: table;
span {
... ...