-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
prevent changing theme to scroll back home
- Loading branch information
Showing
1 changed file
with
10 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,19 @@ | ||
document.addEventListener('DOMContentLoaded', function() { | ||
// auto-toggle navbar on items click | ||
// alternative: https://stackoverflow.com/questions/14248194/close-responsive-navbar-automatically/75808063#75808063 | ||
const navLinks = document.querySelectorAll('.nav-link:not(.dropdown-toggle)') | ||
const menuToggle = document.getElementById('navbar-toggler') | ||
navLinks.forEach((l) => { | ||
l.addEventListener('click', () => { | ||
menuToggle.checkVisibility() && menuToggle.click() | ||
}) | ||
}) | ||
|
||
//prevent changing theme to scroll back home | ||
const navThemeLinks = document.querySelectorAll('#themeMenu > .nav-link') | ||
navThemeLinks.forEach((l) => { | ||
l.setAttribute("href", "javascript:;") | ||
}) | ||
|
||
}); | ||
|