Skip to content

Commit 6765cb1

Browse files
authored
Update ultra.js
Added drop-down support
1 parent 4579b20 commit 6765cb1

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

dist/ultra.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
const Ultra = {
22
init() {
3+
document.querySelectorAll('.ultra-dropdown').forEach(dropdown => {
4+
const button = dropdown.querySelector('.ultra-dropdown-btn');
5+
button.addEventListener('click', (e) => {
6+
e.stopPropagation();
7+
// Close other dropdowns first
8+
document.querySelectorAll('.ultra-dropdown').forEach(d => {
9+
if (d !== dropdown) d.classList.remove('active');
10+
});
11+
dropdown.classList.toggle('active');
12+
});
13+
});
14+
document.addEventListener('click', () => {
15+
document.querySelectorAll('.ultra-dropdown').forEach(dropdown => {
16+
dropdown.classList.remove('active');
17+
});
18+
});
319
// Button ripple effect
420
document.querySelectorAll('button.ultra-button.button-wave').forEach(button => {
521
button.addEventListener('click', function (e) {

0 commit comments

Comments
 (0)