Skip to content

Commit

Permalink
exit search screen with Esc key (#2055)
Browse files Browse the repository at this point in the history
* exit search with esc key feature is added
* closing search screen with esc key feature is added to _main.js
  • Loading branch information
ermissa authored and mmistakes committed Feb 11, 2019
1 parent 8eb880a commit 1e78b16
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions assets/js/_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ $(document).ready(function() {
$(".author__urls-wrapper button").toggleClass("open");
});

// Close search screen with Esc key
$(document).keyup(function(e) {
if (e.keyCode === 27) {
if ($(".initial-content").hasClass("is--hidden")) {
$(".search-content").toggleClass("is--visible");
$(".initial-content").toggleClass("is--hidden");
}
}
});

// Search toggle
$(".search__toggle").on("click", function() {
$(".search-content").toggleClass("is--visible");
Expand Down
2 changes: 1 addition & 1 deletion assets/js/main.min.js
100644 → 100755

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1e78b16

Please sign in to comment.