|
@@ -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() {
|