blob: 00b7ee6ea194398c67800402a3bd10206069f85f (
plain)
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
28
29
30
|
document.addEventListener('DOMContentLoaded', function () {
// Handle dropdown clicks
document.querySelectorAll('.options-subitem > a').forEach(function (item) {
item.addEventListener('click', function (e) {
e.preventDefault();
const parent = this.parentElement;
if (parent.classList.contains('disabled')) {
return;
}
document.querySelectorAll('.options-subitem.open').forEach(function (other) {
if (other !== parent) {
other.classList.remove('open');
}
});
parent.classList.toggle('open');
});
});
// Close dropdowns when clicking outside
document.addEventListener('click', function (e) {
if (!e.target.closest('.options-subitem')) {
document.querySelectorAll('.options-subitem.open').forEach(function (item) {
item.classList.remove('open');
});
}
});
});
|