Skip to content

Commit 2cb2a11

Browse files
committed
fix: should use js in nav right buttons
1 parent 587ce76 commit 2cb2a11

File tree

3 files changed

+25
-12
lines changed

3 files changed

+25
-12
lines changed

src/components/rightbtn.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
document.addEventListener('DOMContentLoaded', () => {
2+
document.querySelector('.nav_right_btn .more')?.addEventListener('click', (e) => {
3+
e.preventDefault();
4+
e.stopPropagation();
5+
const nav = document.querySelector('.nav_right_btn');
6+
if (!nav) return;
7+
nav.classList.add('expanded');
8+
});
9+
document.addEventListener('click', (e) => {
10+
document.querySelector('.nav_right_btn')?.classList.remove('expanded');
11+
});
12+
});

src/main.ts

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import './scss/style.scss';
66
import { Anatolo } from './anatolo/anatolo';
77
import * as Utils from './utils/main';
88
import FloatBtn from './components/float-btn';
9+
import './components/rightbtn';
910

1011
(window as any).Anatolo = Anatolo;
1112
(window as any).Utils = Utils;

src/scss/raw-components/nav.scss

+12-12
Original file line numberDiff line numberDiff line change
@@ -84,21 +84,21 @@
8484
@media screen and (max-width: $bp-small-width-view) {
8585
.information {
8686
background-color: var(--secondary);
87-
.nav_right_btn li {
88-
display: none;
89-
&.more {
90-
display: block;
91-
}
92-
}
93-
&:hover {
94-
right: 0;
95-
position: absolute;
96-
.nav_right_btn li {
97-
display: initial;
98-
&.more {
87+
.nav_right_btn {
88+
&.expanded {
89+
li {
90+
display: initial;
91+
}
92+
li.more {
9993
display: none;
10094
}
10195
}
96+
li {
97+
display: none;
98+
}
99+
li.more {
100+
display: initial;
101+
}
102102
}
103103
}
104104
}

0 commit comments

Comments
 (0)