mirror of
https://gitee.com/dcren/initializr.git
synced 2025-09-18 17:48:14 +08:00
Show hint when more search results are available
This commit is contained in:
@@ -121,9 +121,9 @@ input[type=text] {
|
||||
}
|
||||
|
||||
.tt-suggestion {
|
||||
padding: 3px 20px;
|
||||
font-size: 18px;
|
||||
line-height: 24px;
|
||||
padding: 4px 20px;
|
||||
font-size: 16px;
|
||||
line-height: 22px;
|
||||
}
|
||||
|
||||
.tt-suggestion:hover {
|
||||
@@ -137,6 +137,15 @@ input[type=text] {
|
||||
background-color: #0097cf;
|
||||
}
|
||||
|
||||
.tt-footer {
|
||||
padding: 6px 20px 0px 20px;
|
||||
font-size: 13px;
|
||||
line-height: 15px;
|
||||
text-align: center;
|
||||
font-style: italic;
|
||||
border-top: 1px solid #ccc;
|
||||
}
|
||||
|
||||
footer {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
|
@@ -182,6 +182,7 @@ $(function () {
|
||||
$("body").scrollTop(0);
|
||||
return false;
|
||||
});
|
||||
var maxSuggestions = 5;
|
||||
var starters = new Bloodhound({
|
||||
datumTokenizer: Bloodhound.tokenizers.obj.nonword('name', 'description', 'keywords', 'group'),
|
||||
queryTokenizer: Bloodhound.tokenizers.nonword,
|
||||
@@ -191,6 +192,7 @@ $(function () {
|
||||
sorter: function(a,b) {
|
||||
return b.weight - a.weight;
|
||||
},
|
||||
limit: maxSuggestions,
|
||||
cache: false
|
||||
});
|
||||
initializeSearchEngine(starters, $("#bootVersion").val());
|
||||
@@ -205,6 +207,14 @@ $(function () {
|
||||
templates: {
|
||||
suggestion: function (data) {
|
||||
return "<div><strong>" + data.name + "</strong><br/><small>" + data.description + "</small></div>";
|
||||
},
|
||||
footer: function(search) {
|
||||
if (search.suggestions && search.suggestions.length == maxSuggestions) {
|
||||
return "<div class=\"tt-footer\">More matches, please refine your search</div>";
|
||||
}
|
||||
else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user