Authored by biao

fix size selection bug

@@ -57,6 +57,7 @@ function setActive($item) { @@ -57,6 +57,7 @@ function setActive($item) {
57 57
58 var $colorList = $item.find('.color-list'); 58 var $colorList = $item.find('.color-list');
59 var $sizeList = $item.find('.size-list'); 59 var $sizeList = $item.find('.size-list');
  60 + var activeIndex = 0;
60 61
61 $colorList.find('.img-box').each(function(i, box) { 62 $colorList.find('.img-box').each(function(i, box) {
62 var $box = $(box); 63 var $box = $(box);
@@ -64,10 +65,14 @@ function setActive($item) { @@ -64,10 +65,14 @@ function setActive($item) {
64 if ($box.find('img').data('color') === color) { 65 if ($box.find('img').data('color') === color) {
65 $colorList.find('.img-box').eq(i).addClass('active'); 66 $colorList.find('.img-box').eq(i).addClass('active');
66 67
  68 + activeIndex = i;
  69 +
67 return false; 70 return false;
68 } 71 }
69 }); 72 });
70 73
  74 + $sizeList = $sizeList.eq(activeIndex).removeClass('hide');
  75 +
71 $sizeList.find('span').each(function(i, s) { 76 $sizeList.find('span').each(function(i, s) {
72 var $size = $(s); 77 var $size = $(s);
73 78
1 <div> 1 <div>
2 {{#goodsList}} 2 {{#goodsList}}
3 - <div class="{{#unless @first}}hide{{/unless}} size-list" data-index="{{@index}}"> 3 + <div class="hide size-list" data-index="{{@index}}">
4 {{#sizeList}} 4 {{#sizeList}}
5 <span data-size="{{sizeName}}" data-sku="{{productSku}}" data-id="{{goodsId}}" {{#unless storageNumber}}class="disable"{{/unless}}>{{sizeName}}</span> 5 <span data-size="{{sizeName}}" data-sku="{{productSku}}" data-id="{{goodsId}}" {{#unless storageNumber}}class="disable"{{/unless}}>{{sizeName}}</span>
6 {{/sizeList}} 6 {{/sizeList}}