Skip to content

Commit ed52eca

Browse files
committed
rename shown to navbar-menu-open, refactor to vanilla js
1 parent 33f31d0 commit ed52eca

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

web_src/css/base.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -983,13 +983,13 @@ img.ui.avatar,
983983
#navbar {
984984
align-items: stretch;
985985
}
986-
#navbar.shown {
986+
#navbar.navbar-menu-open {
987987
padding-bottom: 8px;
988988
}
989-
#navbar.shown .item.brand {
989+
#navbar.navbar-menu-open .item.brand {
990990
padding-bottom: 2px;
991991
}
992-
#navbar:not(.shown) > *:not(.item.brand) {
992+
#navbar:not(.navbar-menu-open) > *:not(.item.brand) {
993993
display: none;
994994
}
995995
}

web_src/js/features/common-global.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,13 @@ export function initGlobalFormDirtyLeaveConfirm() {
2020
}
2121

2222
export function initHeadNavbarContentToggle() {
23-
const content = $('#navbar');
24-
const toggle = $('#navbar-expand-toggle');
23+
const navbar = document.getElementById('navbar');
24+
const btn = document.getElementById('navbar-expand-toggle');
2525
let isExpanded = false;
26-
toggle.on('click', () => {
26+
btn.addEventListener('click', () => {
2727
isExpanded = !isExpanded;
28-
if (isExpanded) {
29-
content.addClass('shown');
30-
toggle.addClass('active');
31-
} else {
32-
content.removeClass('shown');
33-
toggle.removeClass('active');
34-
}
28+
navbar.classList.toggle('navbar-menu-open', isExpanded);
29+
btn.classList.toggle('active', isExpanded);
3530
});
3631
}
3732

0 commit comments

Comments
 (0)