Authored by OF1706

history bug

... ... @@ -93,7 +93,7 @@
{{#unless @root.pc.common.disSearchAssociation}}
<ul class="search-suggest"></ul>
{{/unless}}
<ul class="search-suggest search-suggest-history"></ul>
<ul class="search-suggest-history"></ul>
<div class="search-2016">
<form action="//search.yohobuy.com" method="get" id="search-form">
<input type="hidden" id="defaultsearch" value="{{defaultSearch}}">
... ...
... ... @@ -639,9 +639,14 @@ $searchKey.keyup(function(e) {
searchSuggest(val);
}
}
if ($searchKey.val() === '') {
$searchKey.mouseenter();
// 查询历史记录
searchSuggestHistory(); //eslint-disable-line
} else {
$searchHistory.hide();
}
}).focus(function() {
var val = $.trim($(this).val());
... ... @@ -652,7 +657,12 @@ $searchKey.keyup(function(e) {
$(this).css('color', '#333');
setTimeout(function() {
$searchKey.mouseenter();
if ($searchKey.val() === '') {
// 查询历史记录
searchSuggestHistory(); //eslint-disable-line
}
}, 10000);
}).blur(function() {
... ... @@ -661,8 +671,10 @@ $searchKey.keyup(function(e) {
if (val === '') {
$(this).val(defaultSearch).css('color', '#999');
}
setTimeout(function() {
$searchSug.hide();
$searchHistory.hide();
}, 200);
});
... ... @@ -892,6 +904,8 @@ function searchSuggestHistory() {
if ($searchHistory.find('li').length === 0) {
$searchHistory.hide();
} else {
$searchHistory.show();
}
// 历史记录清空
... ... @@ -917,20 +931,9 @@ $searchKey.focus(function() {
if (val === '') {
searchSuggestHistory();
}
}).mouseleave(function() {
$searchHistory.hide();
});
$('.search-suggest-history').mouseenter(function() {
if ($searchHistory.find('li').length === 0) {
$searchHistory.hide();
} else {
$searchHistory.show();
$searchHistory.hide();
}
}).mouseleave(function() {
$searchHistory.hide();
});
/**
... ...
... ... @@ -453,7 +453,7 @@
}
}
.search-suggest {
.search-suggest,.search-suggest-history {
position: absolute;
width: 320px;
box-sizing: border-box;
... ...