Authored by 毕凯

整理代码

@@ -14,6 +14,7 @@ var swiper, @@ -14,6 +14,7 @@ var swiper,
14 $brandList = $('.brand-list'), 14 $brandList = $('.brand-list'),
15 $icon = $('.search-icon'), 15 $icon = $('.search-icon'),
16 $genderItem = $('.genderNav li'), 16 $genderItem = $('.genderNav li'),
  17 + $searchAction = $('.search-action'),
17 hotBrandsSwiper; 18 hotBrandsSwiper;
18 19
19 var searchH = $('.newbrand-search').outerHeight(), 20 var searchH = $('.newbrand-search').outerHeight(),
@@ -156,11 +157,11 @@ if ($('.brand-search-page').length) { @@ -156,11 +157,11 @@ if ($('.brand-search-page').length) {
156 if ($keyword.val().length) { 157 if ($keyword.val().length) {
157 $icon.css('color', '#000'); 158 $icon.css('color', '#000');
158 $(this).closest('.search-box').css('width', '11.25rem'); 159 $(this).closest('.search-box').css('width', '11.25rem');
159 - $('.search-action').show(); 160 + $searchAction.show();
160 } else { 161 } else {
161 $icon.css('color', '#b2b2b2'); 162 $icon.css('color', '#b2b2b2');
162 $(this).closest('.search-box').css('width', '12.5rem'); 163 $(this).closest('.search-box').css('width', '12.5rem');
163 - $('.search-action').hide(); 164 + $searchAction.hide();
164 } 165 }
165 searchResult(); 166 searchResult();
166 }).focus(); 167 }).focus();
@@ -168,13 +169,13 @@ if ($('.brand-search-page').length) { @@ -168,13 +169,13 @@ if ($('.brand-search-page').length) {
168 // 2016.1.13 产品(高扬)要求进入页面默认显示取消按钮 169 // 2016.1.13 产品(高扬)要求进入页面默认显示取消按钮
169 $icon.css('color', '#000'); 170 $icon.css('color', '#000');
170 $keyword.closest('.search-box').css('width', '11.25rem'); 171 $keyword.closest('.search-box').css('width', '11.25rem');
171 - $('.search-action').show(); 172 + $searchAction.show();
172 173
173 clearTextHammer = new Hammer($('.clear-text')[0]); 174 clearTextHammer = new Hammer($('.clear-text')[0]);
174 clearTextHammer.on('tap', function(e) { 175 clearTextHammer.on('tap', function(e) {
175 - e.preventDefault();  
176 $('.search-result').html(''); 176 $('.search-result').html('');
177 $('#keyword').val('').trigger('input'); 177 $('#keyword').val('').trigger('input');
  178 + e.preventDefault();
178 e.srcEvent.stopPropagation(); 179 e.srcEvent.stopPropagation();
179 }); 180 });
180 181