Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Show a "Not Found" message when nothing is found (Closes #84)
  • Loading branch information
zoffixznet committed Aug 22, 2015
1 parent c150897 commit d7719ae
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
12 changes: 12 additions & 0 deletions html/css/style.css
Expand Up @@ -125,7 +125,19 @@ td p {
vertical-align: middle;
}

#search.not-found > div:before {
content: "Sorry, no results were found";
background: red;
color: white;
padding: 2px 15px;
border-radius: 3px;
position: absolute;
bottom: -4ex;
left: 0;
}

#search {
position: relative;
float: right;
margin-right: 1.5em;
margin-bottom: 0.5em;
Expand Down
4 changes: 4 additions & 0 deletions template/search_template.js
@@ -1,6 +1,10 @@
$(function(){
$('#search').css('visibility', 'visible');
$("#query").autocomplete({
response: function( e, ui ) {
if ( ! ui.content.length ) { $('#search').addClass( 'not-found') }
else { $('#search').removeClass('not-found') }
},
position: { my: "right top", at: "right bottom", of: "#search div" },
source: [
ITEMS
Expand Down

0 comments on commit d7719ae

Please sign in to comment.