Skip to content

Commit 0fc6955

Browse files
authored
Update full-screen-search.js
1 parent 8446584 commit 0fc6955

File tree

1 file changed

+33
-29
lines changed

1 file changed

+33
-29
lines changed

assets/js/full-screen-search.js

+33-29
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,43 @@
11
jQuery(document).ready(function($){
22

3-
// ... display the Full Screen search when:
4-
// 1. The user focuses on a search field, or
5-
// 2. The user clicks the Search button
6-
$( '.search-icon-wrapper' ).on( 'click', function( event ) {
7-
// Prevent the default action
8-
event.preventDefault();
9-
10-
// Display the Full Screen Search
11-
$( '#full-screen-search' ).addClass( 'open' );
12-
13-
// Focus on the Full Screen Search Input Field
14-
$( '#full-screen-search input' ).focus();
15-
} );
16-
17-
// Hide the Full Screen search when the user clicks the close button
18-
$( '#full-screen-search button.close' ).on( 'click', function( event ) {
19-
// Prevent the default event
20-
event.preventDefault();
21-
22-
// Hide the Full Screen Search
23-
$( '#full-screen-search' ).removeClass( 'open' );
24-
} );
3+
$(document).ready(function(){
4+
5+
$('.search-icon-wrapper').on('click', function(event){
6+
7+
// Prevent the default action
8+
event.preventDefault();
9+
10+
// Display the Full Screen Search
11+
$( '#full-screen-search' ).addClass( 'open' );
12+
13+
// Focus on the Full Screen Search Input Field
14+
$( '#full-screen-search input' ).focus();
15+
16+
});
17+
18+
$( '#full-screen-search button.close' ).on( 'click', function( event ) {
19+
20+
// Prevent the default event
21+
event.preventDefault();
22+
23+
// Hide the Full Screen Search
24+
$( '#full-screen-search' ).removeClass( 'open' );
25+
26+
});
2527

26-
// Hide the Full Screen search when the user clicks the esc key
27-
$( document ).on( 'keydown', function( event ) {
28+
// Hide the Full Screen search when the user clicks the esc key
29+
$( document ).on( 'keydown', function( event ) {
2830

29-
if (event.key == "Escape") {
31+
if (event.key == "Escape") {
3032

31-
// Hide the Full Screen Search
32-
$( '#full-screen-search' ).removeClass( 'open' );
33+
// Hide the Full Screen Search
34+
$( '#full-screen-search' ).removeClass( 'open' );
3335

34-
}
36+
}
37+
38+
});
3539

36-
} );
40+
});
3741

3842
});
3943

0 commit comments

Comments
 (0)