GoodsSubtitle固定两行&咨询页页头固定 --code reviewed by liangzhifeng
Showing
4 changed files
with
20 additions
and
34 deletions
@@ -16,10 +16,7 @@ var consultFooterEle = document.getElementById('consult-content-footer'), | @@ -16,10 +16,7 @@ var consultFooterEle = document.getElementById('consult-content-footer'), | ||
16 | navtabHammer = navtabEle && new Hammer(navtabEle), | 16 | navtabHammer = navtabEle && new Hammer(navtabEle), |
17 | 17 | ||
18 | gotoConsultEle = document.getElementById('goto-consult'), | 18 | gotoConsultEle = document.getElementById('goto-consult'), |
19 | - gotoConsultHammer = gotoConsultEle && new Hammer(gotoConsultEle), | ||
20 | - | ||
21 | - $gotoConsult = $('#goto-consult'); | ||
22 | - | 19 | + gotoConsultHammer = gotoConsultEle && new Hammer(gotoConsultEle); |
23 | 20 | ||
24 | 21 | ||
25 | (function() { | 22 | (function() { |
@@ -81,20 +78,8 @@ if (gotoConsultHammer) { | @@ -81,20 +78,8 @@ if (gotoConsultHammer) { | ||
81 | }); | 78 | }); |
82 | } | 79 | } |
83 | 80 | ||
84 | -function fixConsultBar() { | ||
85 | - if ($(window).scrollTop() > $('#yoho-header').outerHeight()) { | ||
86 | - $gotoConsult.css('position', 'fixed'); | ||
87 | - $gotoConsult.css('top', '0'); | ||
88 | - } else { | ||
89 | - $gotoConsult.css('position', 'static'); | ||
90 | - } | ||
91 | -} | ||
92 | - | ||
93 | -//滚动时顶部固定 我要咨询 | ||
94 | -function scrollHandler() { | ||
95 | - fixConsultBar(); | 81 | +//咨询页面固定header |
82 | +if ($('.goods-consults-page').length > 0) { | ||
83 | + $('#yoho-header').css('position', 'fixed').css('top', '0'); | ||
96 | } | 84 | } |
97 | 85 | ||
98 | -$(window).scroll(function() { | ||
99 | - window.requestAnimationFrame(scrollHandler); | ||
100 | -}); |
@@ -15,10 +15,7 @@ var goodsSwiper, | @@ -15,10 +15,7 @@ var goodsSwiper, | ||
15 | var goodsDiscountEl = document.getElementById('goodsDiscount'), | 15 | var goodsDiscountEl = document.getElementById('goodsDiscount'), |
16 | goodsDiscountHammer = goodsDiscountEl && new Hammer(goodsDiscountEl); | 16 | goodsDiscountHammer = goodsDiscountEl && new Hammer(goodsDiscountEl); |
17 | 17 | ||
18 | -var $cart = $('.cart-bar'), | ||
19 | - $goodsSubtitle = $('.goodsSubtitle'), | ||
20 | - divH, | ||
21 | - $goodsSubtitleSpan; | 18 | +var $cart = $('.cart-bar'); |
22 | 19 | ||
23 | require('./desc'); | 20 | require('./desc'); |
24 | require('./comments-consults'); | 21 | require('./comments-consults'); |
@@ -85,12 +82,4 @@ $.ajax({ | @@ -85,12 +82,4 @@ $.ajax({ | ||
85 | } | 82 | } |
86 | }); | 83 | }); |
87 | 84 | ||
88 | -//限制goodsSubtitle为两行 | ||
89 | -if ($goodsSubtitle[0]) { | ||
90 | - divH = $goodsSubtitle.height(); | ||
91 | - $goodsSubtitleSpan = $goodsSubtitle.find('span'); | ||
92 | - while ($goodsSubtitleSpan.outerHeight() > divH) { | ||
93 | - $goodsSubtitleSpan.text($goodsSubtitleSpan.text().replace(/(\s)*([a-zA-Z0-9]+|\W)(\.\.\.)?$/, '...')); | ||
94 | - } | ||
95 | -} | ||
96 | require('./like'); | 85 | require('./like'); |
@@ -41,6 +41,8 @@ | @@ -41,6 +41,8 @@ | ||
41 | .goods-consults-page { | 41 | .goods-consults-page { |
42 | background-color: #f0f0f0; | 42 | background-color: #f0f0f0; |
43 | .goto-consult { | 43 | .goto-consult { |
44 | + position: fixed; | ||
45 | + top: 2.25rem; | ||
44 | width: 100%; | 46 | width: 100%; |
45 | box-sizing:border-box; | 47 | box-sizing:border-box; |
46 | padding: 0 pxToRem(28px); | 48 | padding: 0 pxToRem(28px); |
@@ -63,6 +65,8 @@ | @@ -63,6 +65,8 @@ | ||
63 | } | 65 | } |
64 | } | 66 | } |
65 | .goods-consults { | 67 | .goods-consults { |
68 | + margin-top: 5.25rem; | ||
69 | + overflow: hidden; | ||
66 | .consult-item { | 70 | .consult-item { |
67 | margin-top: pxToRem(30px); | 71 | margin-top: pxToRem(30px); |
68 | padding: pxToRem(20px) pxToRem(28px); | 72 | padding: pxToRem(20px) pxToRem(28px); |
@@ -211,18 +211,26 @@ $basicBtnC:#eb0313; | @@ -211,18 +211,26 @@ $basicBtnC:#eb0313; | ||
211 | background-color: #515150; | 211 | background-color: #515150; |
212 | } | 212 | } |
213 | .goodsSubtitle { | 213 | .goodsSubtitle { |
214 | + // display: table; | ||
214 | height: pxToRem(88px); | 215 | height: pxToRem(88px); |
215 | font-size: pxToRem(24px); | 216 | font-size: pxToRem(24px); |
216 | color: $subFontC; | 217 | color: $subFontC; |
217 | padding-left: pxToRem(28px); | 218 | padding-left: pxToRem(28px); |
218 | padding-right: pxToRem(28px); | 219 | padding-right: pxToRem(28px); |
219 | - padding-top: pxToRem(14px); | ||
220 | border-bottom: 1px solid $borderC; | 220 | border-bottom: 1px solid $borderC; |
221 | - background-color: #f4f4f4; | 221 | + background-color: $pageBgC; |
222 | + display: flex; | ||
223 | + align-items: center; | ||
222 | span{ | 224 | span{ |
223 | - display: block; | 225 | + // display: table-cell; |
226 | + display: -webkit-box; | ||
224 | line-height: pxToRem(36px); | 227 | line-height: pxToRem(36px); |
225 | margin: 0; | 228 | margin: 0; |
229 | + text-overflow: -o-ellipsis-lastline; | ||
230 | + overflow: hidden; | ||
231 | + text-overflow: ellipsis; | ||
232 | + -webkit-line-clamp: 2; | ||
233 | + -webkit-box-orient: vertical; | ||
226 | } | 234 | } |
227 | } | 235 | } |
228 | .price-date { | 236 | .price-date { |
-
Please register or login to post a comment