Merge branch 'develop'
Showing
2 changed files
with
23 additions
and
18 deletions
@@ -5,6 +5,7 @@ | @@ -5,6 +5,7 @@ | ||
5 | */ | 5 | */ |
6 | 6 | ||
7 | var $ = require('jquery'), | 7 | var $ = require('jquery'), |
8 | + ellipsis = require('mlellipsis'), | ||
8 | Hammer = require('yoho.hammer'); | 9 | Hammer = require('yoho.hammer'); |
9 | 10 | ||
10 | var chosePanel = require('./chose-panel'), | 11 | var chosePanel = require('./chose-panel'), |
@@ -15,21 +16,33 @@ var $cartContent = $('.cart-content'), | @@ -15,21 +16,33 @@ var $cartContent = $('.cart-content'), | ||
15 | cartType = $('#cartType').val(), | 16 | cartType = $('#cartType').val(), |
16 | hasShowCartPresellTip = false; | 17 | hasShowCartPresellTip = false; |
17 | 18 | ||
18 | -var $cartContentShow = $cartContent.not('.hide'); | ||
19 | - | ||
20 | var navHammer, | 19 | var navHammer, |
21 | advanceBuyHammer, | 20 | advanceBuyHammer, |
22 | freebieHammer, | 21 | freebieHammer, |
23 | switchChose = false; | 22 | switchChose = false; |
24 | 23 | ||
25 | require('../product/recommend-for-you'); | 24 | require('../product/recommend-for-you'); |
25 | +require('./good'); | ||
26 | + | ||
27 | +ellipsis.init(); | ||
28 | + | ||
29 | +function cartContentShow() { | ||
30 | + return $cartContent.not('.hide'); | ||
31 | +} | ||
32 | + | ||
33 | +function mlellipsisHiddenNames() { | ||
34 | + cartContentShow().find('.shopping-cart-good .name').each(function() { | ||
35 | + this.mlellipsis(2); | ||
36 | + }); | ||
37 | + switchChose = true; | ||
38 | +} | ||
26 | 39 | ||
27 | function hasChecked() { | 40 | function hasChecked() { |
28 | - return $cartContentShow.find('.icon-cb-checked').length > 0 ? true : false; | 41 | + return cartContentShow().find('.cart-goods .icon-cb-checked').length > 0 ? true : false; |
29 | } | 42 | } |
30 | 43 | ||
31 | function shouldSelectGift() { | 44 | function shouldSelectGift() { |
32 | - var $freebie = $cartContentShow.find('.freebie'); | 45 | + var $freebie = cartContentShow().find('.freebie'); |
33 | 46 | ||
34 | if ($freebie.length <= 0) { | 47 | if ($freebie.length <= 0) { |
35 | return false; | 48 | return false; |
@@ -70,16 +83,12 @@ function showChooseGifDialog() { | @@ -70,16 +83,12 @@ function showChooseGifDialog() { | ||
70 | rightBtnText: '去选择' | 83 | rightBtnText: '去选择' |
71 | } | 84 | } |
72 | }, function() { | 85 | }, function() { |
73 | - window.location.href = $cartContentShow.find('.freebie > a').attr('href'); | 86 | + window.location.href = cartContentShow().find('.freebie > a').attr('href'); |
74 | }, function() { | 87 | }, function() { |
75 | window.location.href = '/cart/index/orderEnsure?cartType=' + cartType; | 88 | window.location.href = '/cart/index/orderEnsure?cartType=' + cartType; |
76 | }); | 89 | }); |
77 | } | 90 | } |
78 | 91 | ||
79 | -require('./good'); | ||
80 | - | ||
81 | -//lazyLoad($('img.lazy')); | ||
82 | - | ||
83 | if (typeof window.cookie === 'function' && 'y' === window.cookie('_hasShowCartPresellTip')) { | 92 | if (typeof window.cookie === 'function' && 'y' === window.cookie('_hasShowCartPresellTip')) { |
84 | $('#presell-tip').removeClass('show').addClass('hide'); | 93 | $('#presell-tip').removeClass('show').addClass('hide'); |
85 | hasShowCartPresellTip = true; | 94 | hasShowCartPresellTip = true; |
@@ -91,9 +100,9 @@ if ('advance' === cartType) { | @@ -91,9 +100,9 @@ if ('advance' === cartType) { | ||
91 | $cartContent.toggleClass('hide'); | 100 | $cartContent.toggleClass('hide'); |
92 | $('#common-cart-nav').removeClass('active'); | 101 | $('#common-cart-nav').removeClass('active'); |
93 | $('#presell-cart-nav').addClass('active'); | 102 | $('#presell-cart-nav').addClass('active'); |
94 | - $('.shopping-cart-good .name').each(function() { | ||
95 | - this.mlellipsis(2); | ||
96 | - }); | 103 | + |
104 | + mlellipsisHiddenNames(); | ||
105 | + $(window).trigger('scroll'); | ||
97 | } | 106 | } |
98 | 107 | ||
99 | if ($('.cart-nav').length > 0) { | 108 | if ($('.cart-nav').length > 0) { |
@@ -119,13 +128,8 @@ if ($('.cart-nav').length > 0) { | @@ -119,13 +128,8 @@ if ($('.cart-nav').length > 0) { | ||
119 | //切换普通商品和预售商品购物车显示 | 128 | //切换普通商品和预售商品购物车显示 |
120 | $cartContent.toggleClass('hide'); | 129 | $cartContent.toggleClass('hide'); |
121 | 130 | ||
122 | - $cartContentShow = $cartContent.not('.hide'); | ||
123 | - | ||
124 | if (switchChose === false) { | 131 | if (switchChose === false) { |
125 | - $cartContentShow.find('.shopping-cart-good .name').each(function() { | ||
126 | - this.mlellipsis(2); | ||
127 | - }); | ||
128 | - switchChose = true; | 132 | + mlellipsisHiddenNames(); |
129 | } | 133 | } |
130 | 134 | ||
131 | //trigger lazyload | 135 | //trigger lazyload |
-
Please register or login to post a comment