blob: 38690dfd555494723a3d2b1ed3b4d83e42c778af [file] [log] [blame]
Huguet57ae6d9742018-07-23 01:07:26 +02001// Get the box
2var searchBox = document.getElementById('searchBox');
3
4// Get the button that opens the box
5var searchButton = document.getElementById("searchButton");
6
7// Get the <span> element that closes the box
8var closeBox = document.getElementsByClassName("closeBox")[0];
9
10// When the user clicks the button, open the box
11searchButton.onclick = function() {
12 searchBox.style.display = "block";
13}
14
15// When the user clicks on <span> (x), close the box
16closeBox.onclick = function() {
17 searchBox.style.display = "none";
18}
19
20// When the user clicks anywhere outside of the box, close it
21window.onclick = function(event) {
22 if (event.target == searchBox) {
23 searchBox.style.display = "none";
24 }
25}