This repository has been archived on 2023-08-24. You can view files and clone it, but cannot push or open issues or pull requests.
athena.fb-infra.uk/js/nav.js

20 lines
616 B
JavaScript
Raw Normal View History

/* When the user clicks on the button,
toggle between hiding and showing the dropdown content */
function myFunction() {
document.getElementById("myDropdown").classList.toggle("show");
2022-09-08 21:05:49 +01:00
}
// Close the dropdown menu if the user clicks outside of it
window.onclick = function(event) {
if (!event.target.matches('.dropbtn')) {
var dropdowns = document.getElementsByClassName("dropdown-content");
var i;
for (i = 0; i < dropdowns.length; i++) {
var openDropdown = dropdowns[i];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
}
2022-09-08 21:05:49 +01:00
}