|
@@ -639,9 +639,14 @@ $searchKey.keyup(function(e) { |
|
@@ -639,9 +639,14 @@ $searchKey.keyup(function(e) { |
639
|
searchSuggest(val);
|
639
|
searchSuggest(val);
|
640
|
}
|
640
|
}
|
641
|
}
|
641
|
}
|
|
|
642
|
+
|
642
|
if ($searchKey.val() === '') {
|
643
|
if ($searchKey.val() === '') {
|
643
|
- $searchKey.mouseenter();
|
644
|
+ // 查询历史记录
|
|
|
645
|
+ searchSuggestHistory(); //eslint-disable-line
|
|
|
646
|
+ } else {
|
|
|
647
|
+ $searchHistory.hide();
|
644
|
}
|
648
|
}
|
|
|
649
|
+
|
645
|
}).focus(function() {
|
650
|
}).focus(function() {
|
646
|
var val = $.trim($(this).val());
|
651
|
var val = $.trim($(this).val());
|
647
|
|
652
|
|
|
@@ -652,7 +657,12 @@ $searchKey.keyup(function(e) { |
|
@@ -652,7 +657,12 @@ $searchKey.keyup(function(e) { |
652
|
$(this).css('color', '#333');
|
657
|
$(this).css('color', '#333');
|
653
|
|
658
|
|
654
|
setTimeout(function() {
|
659
|
setTimeout(function() {
|
655
|
- $searchKey.mouseenter();
|
660
|
+
|
|
|
661
|
+ if ($searchKey.val() === '') {
|
|
|
662
|
+ // 查询历史记录
|
|
|
663
|
+ searchSuggestHistory(); //eslint-disable-line
|
|
|
664
|
+ }
|
|
|
665
|
+
|
656
|
}, 10000);
|
666
|
}, 10000);
|
657
|
|
667
|
|
658
|
}).blur(function() {
|
668
|
}).blur(function() {
|
|
@@ -661,8 +671,10 @@ $searchKey.keyup(function(e) { |
|
@@ -661,8 +671,10 @@ $searchKey.keyup(function(e) { |
661
|
if (val === '') {
|
671
|
if (val === '') {
|
662
|
$(this).val(defaultSearch).css('color', '#999');
|
672
|
$(this).val(defaultSearch).css('color', '#999');
|
663
|
}
|
673
|
}
|
|
|
674
|
+
|
664
|
setTimeout(function() {
|
675
|
setTimeout(function() {
|
665
|
$searchSug.hide();
|
676
|
$searchSug.hide();
|
|
|
677
|
+ $searchHistory.hide();
|
666
|
}, 200);
|
678
|
}, 200);
|
667
|
});
|
679
|
});
|
668
|
|
680
|
|
|
@@ -892,6 +904,8 @@ function searchSuggestHistory() { |
|
@@ -892,6 +904,8 @@ function searchSuggestHistory() { |
892
|
|
904
|
|
893
|
if ($searchHistory.find('li').length === 0) {
|
905
|
if ($searchHistory.find('li').length === 0) {
|
894
|
$searchHistory.hide();
|
906
|
$searchHistory.hide();
|
|
|
907
|
+ } else {
|
|
|
908
|
+ $searchHistory.show();
|
895
|
}
|
909
|
}
|
896
|
|
910
|
|
897
|
// 历史记录清空
|
911
|
// 历史记录清空
|
|
@@ -917,20 +931,9 @@ $searchKey.focus(function() { |
|
@@ -917,20 +931,9 @@ $searchKey.focus(function() { |
917
|
|
931
|
|
918
|
if (val === '') {
|
932
|
if (val === '') {
|
919
|
searchSuggestHistory();
|
933
|
searchSuggestHistory();
|
920
|
- }
|
|
|
921
|
-}).mouseleave(function() {
|
|
|
922
|
- $searchHistory.hide();
|
|
|
923
|
-});
|
|
|
924
|
-
|
|
|
925
|
-$('.search-suggest-history').mouseenter(function() {
|
|
|
926
|
-
|
|
|
927
|
- if ($searchHistory.find('li').length === 0) {
|
|
|
928
|
- $searchHistory.hide();
|
|
|
929
|
} else {
|
934
|
} else {
|
930
|
- $searchHistory.show();
|
935
|
+ $searchHistory.hide();
|
931
|
}
|
936
|
}
|
932
|
-}).mouseleave(function() {
|
|
|
933
|
- $searchHistory.hide();
|
|
|
934
|
});
|
937
|
});
|
935
|
|
938
|
|
936
|
/**
|
939
|
/**
|