mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2025-01-18 19:00:24 +00:00
fixes #40
This commit is contained in:
parent
c42f7aa6c1
commit
797ac73ff9
2 changed files with 2 additions and 15 deletions
|
@ -1,6 +1,6 @@
|
|||
<div class="searchbox">
|
||||
<label for="search-by"><i class="fa fa-search"></i></label>
|
||||
<input id="search-by" type="text" placeholder="Search">
|
||||
<input data-search-input id="search-by" type="text" placeholder="Search">
|
||||
<span data-search-clear=""><i class="fa fa-close"></i></span>
|
||||
</div>
|
||||
<script type="text/javascript" src="{{ .Site.BaseURL }}/js/lunr.min.js"></script>
|
||||
|
|
|
@ -139,20 +139,7 @@ jQuery(document).ready(function() {
|
|||
$(".highlightable").unhighlight({ element: 'mark' }).highlight(value, { element: 'mark' });
|
||||
|
||||
if (ajax && ajax.abort) ajax.abort();
|
||||
ajax = jQuery.ajax({
|
||||
url: input.data('search-input') + ':' + value
|
||||
}).done(function(data) {
|
||||
if (data && data.results && data.results.length) {
|
||||
items.css('display', 'none');
|
||||
$('ul.topics').addClass('searched');
|
||||
data.results.forEach(function(navitem) {
|
||||
jQuery('[data-nav-id="' + navitem + '"]').css('display', 'block').addClass('search-match');
|
||||
jQuery('[data-nav-id="' + navitem + '"]').parents('li').css('display', 'block');
|
||||
});
|
||||
}
|
||||
;
|
||||
|
||||
});
|
||||
|
||||
jQuery('[data-search-clear]').on('click', function() {
|
||||
jQuery('[data-search-input]').val('').trigger('input');
|
||||
sessionStorage.removeItem('search-input');
|
||||
|
|
Loading…
Reference in a new issue