-
Notifications
You must be signed in to change notification settings - Fork 0
/
script1.js
27 lines (24 loc) · 950 Bytes
/
script1.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
25
26
27
document.addEventListener('DOMContentLoaded', function() {
const dropdown = document.querySelector('.dropdown');
const dropdownMenu = document.querySelector('.dropdown-menu');
if (dropdown) {
dropdown.addEventListener('click', function() {
dropdownMenu.classList.toggle('show');
});
}
// Close the dropdown menu if the user clicks outside of it
window.addEventListener('click', function(event) {
if (!event.target.matches('.dropbtn')) {
const dropdowns = document.getElementsByClassName("dropdown-menu");
for (let i = 0; i < dropdowns.length; i++) {
const openDropdown = dropdowns[i];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
}
});
});
function viewCertificate(certificate) {
window.open(certificate, '_blank');
}