Authored by Lynnic

GoodsSubtitle固定两行&咨询页页头固定 --code reviewed by liangzhifeng

... ... @@ -16,10 +16,7 @@ var consultFooterEle = document.getElementById('consult-content-footer'),
navtabHammer = navtabEle && new Hammer(navtabEle),
gotoConsultEle = document.getElementById('goto-consult'),
gotoConsultHammer = gotoConsultEle && new Hammer(gotoConsultEle),
$gotoConsult = $('#goto-consult');
gotoConsultHammer = gotoConsultEle && new Hammer(gotoConsultEle);
(function() {
... ... @@ -81,20 +78,8 @@ if (gotoConsultHammer) {
});
}
function fixConsultBar() {
if ($(window).scrollTop() > $('#yoho-header').outerHeight()) {
$gotoConsult.css('position', 'fixed');
$gotoConsult.css('top', '0');
} else {
$gotoConsult.css('position', 'static');
}
}
//滚动时顶部固定 我要咨询
function scrollHandler() {
fixConsultBar();
//咨询页面固定header
if ($('.goods-consults-page').length > 0) {
$('#yoho-header').css('position', 'fixed').css('top', '0');
}
$(window).scroll(function() {
window.requestAnimationFrame(scrollHandler);
});
... ...
... ... @@ -15,10 +15,7 @@ var goodsSwiper,
var goodsDiscountEl = document.getElementById('goodsDiscount'),
goodsDiscountHammer = goodsDiscountEl && new Hammer(goodsDiscountEl);
var $cart = $('.cart-bar'),
$goodsSubtitle = $('.goodsSubtitle'),
divH,
$goodsSubtitleSpan;
var $cart = $('.cart-bar');
require('./desc');
require('./comments-consults');
... ... @@ -85,12 +82,4 @@ $.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 {
position: fixed;
top: 2.25rem;
width: 100%;
box-sizing:border-box;
padding: 0 pxToRem(28px);
... ... @@ -63,6 +65,8 @@
}
}
.goods-consults {
margin-top: 5.25rem;
overflow: hidden;
.consult-item {
margin-top: pxToRem(30px);
padding: pxToRem(20px) pxToRem(28px);
... ...
... ... @@ -211,18 +211,26 @@ $basicBtnC:#eb0313;
background-color: #515150;
}
.goodsSubtitle {
// display: table;
height: pxToRem(88px);
font-size: pxToRem(24px);
color: $subFontC;
padding-left: pxToRem(28px);
padding-right: pxToRem(28px);
padding-top: pxToRem(14px);
border-bottom: 1px solid $borderC;
background-color: #f4f4f4;
background-color: $pageBgC;
display: flex;
align-items: center;
span{
display: block;
// display: table-cell;
display: -webkit-box;
line-height: pxToRem(36px);
margin: 0;
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
}
.price-date {
... ...