Skip to content

Commit

Permalink
search feature: make sure page scrollbar disappears when searching bu…
Browse files Browse the repository at this point in the history
…t a scrollbar for search items shows if needed
  • Loading branch information
daattali committed May 30, 2021
1 parent fd1e03a commit 30a757d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions assets/css/beautifuljekyll.css
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,8 @@ pre {
margin-top: 1.5rem;
color: #fff;
font-size: 1.5rem;
max-height: calc(100vh - 6.5rem);
overflow-y: auto;
}
#search-results-container a {
color: #fff;
Expand Down
7 changes: 6 additions & 1 deletion assets/js/beautifuljekyll.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,18 @@ var BeautifulJekyllJS = {
e.preventDefault();
$("#beautifuljekyll-search-overlay").show();
$("#nav-search-input").focus().select();
$("body").addClass("overflow-hidden");
});
$("#nav-search-exit").click(function(e) {
e.preventDefault();
$("#beautifuljekyll-search-overlay").hide();
$("body").removeClass("overflow-hidden");
});
$(document).on('keyup', function(e) {
if (e.key == "Escape") $("#beautifuljekyll-search-overlay").hide();
if (e.key == "Escape") {
$("#beautifuljekyll-search-overlay").hide();
$("body").removeClass("overflow-hidden");
}
});
}
};
Expand Down

0 comments on commit 30a757d

Please sign in to comment.