Authored by hf

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

@@ -9,14 +9,21 @@ var $searchBox = $('.search-box'), @@ -9,14 +9,21 @@ var $searchBox = $('.search-box'),
9 $indexSearch = $('.index-search'), 9 $indexSearch = $('.index-search'),
10 $indexLogo = $('.index-logo'); 10 $indexLogo = $('.index-logo');
11 11
12 -var $search = $searchBox.children('input'),  
13 - $cancelSearch = $indexSearch.children('.no-search'); 12 +var $search = $searchBox.children('input[type="text"]'),
  13 + $cancelSearch = $indexSearch.children('.no-search'),
  14 + $searchIcon = $searchBox.children('.search-icon');
14 15
15 require('../common'); 16 require('../common');
16 17
17 $search.on('focus', function() { 18 $search.on('focus', function() {
18 $indexSearch.addClass('action'); 19 $indexSearch.addClass('action');
19 $indexLogo.addClass('action'); 20 $indexLogo.addClass('action');
  21 +}).on('input', function() {
  22 + if ($search.val() === '') {
  23 + $searchIcon.addClass('empty');
  24 + } else {
  25 + $searchIcon.removeClass('empty');
  26 + }
20 }); 27 });
21 28
22 $cancelSearch.on('touchstart', function() { 29 $cancelSearch.on('touchstart', function() {
@@ -27,7 +34,7 @@ $cancelSearch.on('touchstart', function() { @@ -27,7 +34,7 @@ $cancelSearch.on('touchstart', function() {
27 }); 34 });
28 35
29 $searchBox.children('.clear-text').on('touchstart', function() { 36 $searchBox.children('.clear-text').on('touchstart', function() {
30 - $search.val('').focus(); 37 + $search.val('').focus().trigger('input');
31 }); 38 });
32 39
33 $searchBox.children('.search-icon').on('touchstart', function() { 40 $searchBox.children('.search-icon').on('touchstart', function() {
@@ -81,9 +81,13 @@ @@ -81,9 +81,13 @@
81 } 81 }
82 .search-icon { 82 .search-icon {
83 right: 10rem / $pxConvertRem; 83 right: 10rem / $pxConvertRem;
  84 + color: #000;
  85 +
  86 + &.empty {
84 color: #e6e6e6; 87 color: #e6e6e6;
85 } 88 }
86 } 89 }
  90 + }
87 91
88 .no-search { 92 .no-search {
89 display: none; 93 display: none;
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 <input type="hidden" name="from" value="search"> 9 <input type="hidden" name="from" value="search">
10 <input type="text" name="query" placeholder="搜索" autocomplete="off"> 10 <input type="text" name="query" placeholder="搜索" autocomplete="off">
11 <span class="iconfont clear-text">&#xe623;</span> 11 <span class="iconfont clear-text">&#xe623;</span>
12 - <span class="iconfont search-icon">&#xe60f;</span> 12 + <span class="iconfont search-icon empty">&#xe60f;</span>
13 </div> 13 </div>
14 </form> 14 </form>
15 </div> 15 </div>