Authored by 毕凯

悬浮购物车数字大于99 显示99+

@@ -12,8 +12,14 @@ $.ajax({ @@ -12,8 +12,14 @@ $.ajax({
12 type: 'GET', 12 type: 'GET',
13 url: '/cart/index/count', 13 url: '/cart/index/count',
14 success: function(data) { 14 success: function(data) {
  15 + var count;
  16 +
15 if (data.code === 200) { 17 if (data.code === 200) {
16 - $cart.find('.cart-count').html(data.data.cart_goods_count).removeClass('hide'); 18 + count = data.data.cart_goods_count;
  19 + if (count > 99) {
  20 + count = '99+';
  21 + }
  22 + $cart.find('.cart-count').html(count).removeClass('hide');
17 } 23 }
18 } 24 }
19 }); 25 });
@@ -23,13 +23,16 @@ @@ -23,13 +23,16 @@
23 23
24 .cart-count { 24 .cart-count {
25 position: absolute; 25 position: absolute;
26 - width: 18px;  
27 - height: 18px;  
28 - line-height: 18px;  
29 - border-radius: 50%;  
30 - background: #f00;  
31 - top: 0;  
32 - right: 0; 26 + top: -12px;
  27 + right: -10px;
  28 + width: 36px;
  29 + height: 36px;
  30 + font-size: 20px;
  31 + line-height: 36px;
33 color: #fff; 32 color: #fff;
  33 + background: #f03d35;
  34 + text-align: center;
  35 + border-radius: 50%;
  36 + @include transform(scale(0.5));
34 } 37 }
35 } 38 }