forked from iWarpBTC/iWarpBTC.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
drop.js
24 lines (22 loc) · 748 Bytes
/
drop.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* When the user clicks on the button,
toggle between hiding and showing the dropdown content */
function dropIt() {
document.getElementById("dropdown").classList.toggle("show");
}
function dropDonate() {
document.getElementById("donate").classList.toggle("show");
document.getElementById("donate").scrollIntoView();
}
// Close the dropdown if the user clicks outside of it
window.onclick = function(event) {
if (!event.target.matches('.dropbtn')) {
var dropdowns = document.getElementsByClassName("dropdown-menu");
var i;
for (i = 0; i < dropdowns.length; i++) {
var openDropdown = dropdowns[i];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
}
}