Skip to content

Commit

Permalink
fix theme position
Browse files Browse the repository at this point in the history
  • Loading branch information
bjohansebas committed Aug 10, 2024
1 parent 67010e7 commit f3c78f3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 deletions.
7 changes: 7 additions & 0 deletions css/menu.css
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
#navbar {
padding: 0;
top: 1px;
position: static;
}

#navmenu>li:first-child {
Expand Down Expand Up @@ -155,6 +156,7 @@
.submenu-content li a {
font-size: 16px !important;
padding: 5px 5px 5px 5%;
padding-left: 10% !important;
}

.submenu-content li {
Expand All @@ -165,4 +167,9 @@
background: #cccccc;
color: #666 !important;
}

#theme-icon-container{
position: absolute;bottom: 15px;
z-index: 10000;
}
}
12 changes: 0 additions & 12 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,18 +144,6 @@ $(function(){
$(this).next().addClass('active')
})

// show mobile menu
$('#nav-button').click(function () {
$('#navmenu').toggleClass('opens');
$('#overlay').toggleClass('blurs');
});

// close mobile menu
$('#overlay').click(function () {
$('#navmenu').removeClass('opens');
$('#overlay').removeClass('blurs');
});

// i18n notice
if (readCookie('i18nClose')) {
$('#i18n-notice-box').hide()
Expand Down
17 changes: 15 additions & 2 deletions js/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ for (const el of $itemsMenu) {
});

el.addEventListener("click", () => {
$itemsMenu.forEach((item) => {
for (const item of $itemsMenu) {
if (item.id !== el.id) {
item.classList.remove("open");
}
});
}
el.classList.toggle("open");
});
}
Expand All @@ -35,6 +35,8 @@ for (const el of $itemsMenu) {

const $linkItemsMenu = document.querySelectorAll(".submenu > a");
const $linkItemsContentMenu = document.querySelectorAll(".submenu-content a");
const $menu = document.querySelector("#navmenu");
const $overlay = document.querySelector("#overlay");

for (const el of $linkItemsMenu) {
el.addEventListener("click", (e) => {
Expand All @@ -46,6 +48,17 @@ for (const el of $linkItemsMenu) {
});
}

document.querySelector("#nav-button").addEventListener("click", () => {
$menu.classList.toggle("opens");
$overlay.classList.toggle("blurs");
});

// close mobile menu
$overlay.addEventListener("click", () => {
$menu.classList.remove("opens");
$overlay.classList.remove("blurs");
});

// hilight the menu item of the current page
document
.querySelector(`.submenu-content a[href="${document.location.pathname}"]`)
Expand Down

0 comments on commit f3c78f3

Please sign in to comment.