Authored by xuqi

comments

@@ -23,8 +23,6 @@ var $brandDefault = $('.brand .default'), @@ -23,8 +23,6 @@ var $brandDefault = $('.brand .default'),
23 23
24 var $brandMoreTxt, $brandMoreIcon; 24 var $brandMoreTxt, $brandMoreIcon;
25 25
26 -// var uriLoc = require('./uri');  
27 -  
28 //清除checkbox选中状态 26 //清除checkbox选中状态
29 function clearChecked($checkbox) { 27 function clearChecked($checkbox) {
30 $checkbox.removeClass('checked').html(checkUnicode.unchecked); 28 $checkbox.removeClass('checked').html(checkUnicode.unchecked);
@@ -67,30 +65,7 @@ $('.filter-box').on('selectstart', '.attr, .brands-index span', function() { @@ -67,30 +65,7 @@ $('.filter-box').on('selectstart', '.attr, .brands-index span', function() {
67 return false; 65 return false;
68 }); 66 });
69 67
70 -//checkbox  
71 -$('.check-container').on('click', '.attr', function() {  
72 - var $this = $(this),  
73 - $check = $this.find('.checkbox'),  
74 - $btnOk = $this.parent('.check-container').next('.btns').find('.multi-select-ok');  
75 -  
76 - $check.toggleClass('checked');  
77 -  
78 - if ($check.hasClass('checked')) {  
79 - $check.html(checkUnicode.checked);  
80 - } else {  
81 - $check.html(checkUnicode.unchecked);  
82 - }  
83 -  
84 - //更新按钮状态  
85 - if ($check.hasClass('checked') ||  
86 - $this.siblings('.attr').find('.checked').length > 0) {  
87 - $btnOk.removeClass('dis');  
88 - } else {  
89 - $btnOk.addClass('dis');  
90 - }  
91 -});  
92 -  
93 -//品牌多选 68 +//【品牌】多选
94 $brandMulti.click(function() { 69 $brandMulti.click(function() {
95 if ($brandPanel.css('display') === 'none') { 70 if ($brandPanel.css('display') === 'none') {
96 71
@@ -102,6 +77,7 @@ $brandMulti.click(function() { @@ -102,6 +77,7 @@ $brandMulti.click(function() {
102 $(this).addClass('hide'); 77 $(this).addClass('hide');
103 }); 78 });
104 79
  80 +//【品牌】更多
105 $brandMore.click(function() { 81 $brandMore.click(function() {
106 var $this = $(this); 82 var $this = $(this);
107 83
@@ -120,7 +96,7 @@ $brandMore.click(function() { @@ -120,7 +96,7 @@ $brandMore.click(function() {
120 $(this).toggleClass('more'); 96 $(this).toggleClass('more');
121 }); 97 });
122 98
123 -//品牌索引 99 +//【品牌】索引
124 $('.brands-index').on('click', 'span', function() { 100 $('.brands-index').on('click', 'span', function() {
125 var $this = $(this), 101 var $this = $(this),
126 index = $this.data('index'); 102 index = $this.data('index');
@@ -134,7 +110,7 @@ $('.brands-index').on('click', 'span', function() { @@ -134,7 +110,7 @@ $('.brands-index').on('click', 'span', function() {
134 } 110 }
135 }); 111 });
136 112
137 -//品牌搜索 113 +//【品牌】搜索
138 $('#brand-search-input').keyup(function() { 114 $('#brand-search-input').keyup(function() {
139 var val = $(this).val().toLowerCase(); 115 var val = $(this).val().toLowerCase();
140 116
@@ -145,6 +121,7 @@ $('#brand-search-input').keyup(function() { @@ -145,6 +121,7 @@ $('#brand-search-input').keyup(function() {
145 } 121 }
146 }); 122 });
147 123
  124 +//【品牌】多选确定
148 $('#brand-multi-ok').click(function() { 125 $('#brand-multi-ok').click(function() {
149 var val = ''; 126 var val = '';
150 127
@@ -161,7 +138,7 @@ $('#brand-multi-ok').click(function() { @@ -161,7 +138,7 @@ $('#brand-multi-ok').click(function() {
161 uriLoc('brand', val); 138 uriLoc('brand', val);
162 }); 139 });
163 140
164 -//多选取消(品牌/高级选项) 141 +//【品牌/高级选项】多选取消
165 $('.multi-select-cancel').click(function() { 142 $('.multi-select-cancel').click(function() {
166 var $panel = $(this).closest('.multi'); 143 var $panel = $(this).closest('.multi');
167 144
@@ -175,7 +152,37 @@ $('.multi-select-cancel').click(function() { @@ -175,7 +152,37 @@ $('.multi-select-cancel').click(function() {
175 clearChecked($panel.find('.checkbox.checked')); //清除选中状态 152 clearChecked($panel.find('.checkbox.checked')); //清除选中状态
176 }); 153 });
177 154
178 -//用户定义价格处理 155 +//【品牌/高级选项】checkbox
  156 +$('.check-container').on('click', '.attr', function() {
  157 + var $this = $(this),
  158 + $check = $this.find('.checkbox'),
  159 + $btnOk = $this.parent('.check-container').next('.btns').find('.multi-select-ok');
  160 +
  161 + $check.toggleClass('checked');
  162 +
  163 + if ($check.hasClass('checked')) {
  164 + $check.html(checkUnicode.checked);
  165 + } else {
  166 + $check.html(checkUnicode.unchecked);
  167 + }
  168 +
  169 + //更新按钮状态
  170 + if ($check.hasClass('checked') ||
  171 + $this.siblings('.attr').find('.checked').length > 0) {
  172 + $btnOk.removeClass('dis');
  173 + } else {
  174 + $btnOk.addClass('dis');
  175 + }
  176 +});
  177 +
  178 +//【品牌/高级选项】当多选时阻止链接默认跳转
  179 +$('.brand, .senior').on('click', '.attr > a', function(e) {
  180 + if ($(this).closest('.multi').length > 0) {
  181 + e.preventDefault();
  182 + }
  183 +});
  184 +
  185 +//【价格】用户定义价格处理
179 (function() { 186 (function() {
180 var $udPrice = $('.ud-price-range'), 187 var $udPrice = $('.ud-price-range'),
181 interReg = /^\d+$/, 188 interReg = /^\d+$/,
@@ -222,14 +229,14 @@ $('.multi-select-cancel').click(function() { @@ -222,14 +229,14 @@ $('.multi-select-cancel').click(function() {
222 }); 229 });
223 }()); 230 }());
224 231
225 -//高级选 232 +//【高级选项】鼠标移入显示子
226 $('.senior-attr-wrap').on('mouseenter', '.attr', function() { 233 $('.senior-attr-wrap').on('mouseenter', '.attr', function() {
227 $(this).children('.sub').removeClass('hide'); 234 $(this).children('.sub').removeClass('hide');
228 }).on('mouseleave', '.attr', function() { 235 }).on('mouseleave', '.attr', function() {
229 $(this).children('.sub').addClass('hide'); 236 $(this).children('.sub').addClass('hide');
230 }); 237 });
231 238
232 -//高级选项多选 239 +//【高级选项】多选
233 $('.sub').on('click', '.multi-select', function() { 240 $('.sub').on('click', '.multi-select', function() {
234 $(this).closest('.sub').addClass('multi'); 241 $(this).closest('.sub').addClass('multi');
235 }).on('click', '.multi-select-ok', function() { 242 }).on('click', '.multi-select-ok', function() {
@@ -248,11 +255,4 @@ $('.sub').on('click', '.multi-select', function() { @@ -248,11 +255,4 @@ $('.sub').on('click', '.multi-select', function() {
248 }); 255 });
249 256
250 uriLoc($sub.data('attr'), val); 257 uriLoc($sub.data('attr'), val);
251 -});  
252 -  
253 -//当多选时阻止品牌和高级选项的默认跳转  
254 -$('.brand, .senior').on('click', '.attr > a', function(e) {  
255 - if ($(this).closest('.multi').length > 0) {  
256 - e.preventDefault();  
257 - }  
258 }); 258 });