Skip to content

Commit d7719ae

Browse files
committed
Show a "Not Found" message when nothing is found (Closes #84)
1 parent c150897 commit d7719ae

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

html/css/style.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,19 @@ td p {
125125
vertical-align: middle;
126126
}
127127

128+
#search.not-found > div:before {
129+
content: "Sorry, no results were found";
130+
background: red;
131+
color: white;
132+
padding: 2px 15px;
133+
border-radius: 3px;
134+
position: absolute;
135+
bottom: -4ex;
136+
left: 0;
137+
}
138+
128139
#search {
140+
position: relative;
129141
float: right;
130142
margin-right: 1.5em;
131143
margin-bottom: 0.5em;

template/search_template.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
$(function(){
22
$('#search').css('visibility', 'visible');
33
$("#query").autocomplete({
4+
response: function( e, ui ) {
5+
if ( ! ui.content.length ) { $('#search').addClass( 'not-found') }
6+
else { $('#search').removeClass('not-found') }
7+
},
48
position: { my: "right top", at: "right bottom", of: "#search div" },
59
source: [
610
ITEMS

0 commit comments

Comments
 (0)