Skip to content

Commit

Permalink
fix: should use js in nav right buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
Lhcfl committed Sep 9, 2024
1 parent 587ce76 commit 2cb2a11
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
12 changes: 12 additions & 0 deletions src/components/rightbtn.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
document.addEventListener('DOMContentLoaded', () => {
document.querySelector('.nav_right_btn .more')?.addEventListener('click', (e) => {
e.preventDefault();
e.stopPropagation();
const nav = document.querySelector('.nav_right_btn');
if (!nav) return;
nav.classList.add('expanded');
});
document.addEventListener('click', (e) => {
document.querySelector('.nav_right_btn')?.classList.remove('expanded');
});
});
1 change: 1 addition & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import './scss/style.scss';
import { Anatolo } from './anatolo/anatolo';
import * as Utils from './utils/main';
import FloatBtn from './components/float-btn';
import './components/rightbtn';

(window as any).Anatolo = Anatolo;
(window as any).Utils = Utils;
Expand Down
24 changes: 12 additions & 12 deletions src/scss/raw-components/nav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -84,21 +84,21 @@
@media screen and (max-width: $bp-small-width-view) {
.information {
background-color: var(--secondary);
.nav_right_btn li {
display: none;
&.more {
display: block;
}
}
&:hover {
right: 0;
position: absolute;
.nav_right_btn li {
display: initial;
&.more {
.nav_right_btn {
&.expanded {
li {
display: initial;
}
li.more {
display: none;
}
}
li {
display: none;
}
li.more {
display: initial;
}
}
}
}
Expand Down

0 comments on commit 2cb2a11

Please sign in to comment.