Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancements: Improved Navbar Visibility and Automatic Closing Feature #504

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
updated the navbar scrolling feature
premsaivarmachekuri committed Jul 16, 2023
commit 26e00da5030a74c498887adbd482ed956bb1f856
18 changes: 17 additions & 1 deletion assets/js/main.js
Original file line number Diff line number Diff line change
@@ -96,12 +96,28 @@
/**
* Mobile nav toggle
*/
on("click", ".mobile-nav-toggle", function (e) {

function toggleMobileNav(){
select("#navbar").classList.toggle("navbar-mobile");
this.classList.toggle("bi-list");
this.classList.toggle("bi-x");
}
function handleScroll(){
const navbar = select("#navbar")
if(navbar.classList.contains("navbar-mobile")){
toggleMobileNav();
}
}
on("click", ".mobile-nav-toggle", function (e) {
toggleMobileNav();
});

let prevScrollPos = window.scrollY;
window.addEventListener('scroll', () => {
handleScroll();
prevScrollPos = window.scrollY;
})

/**
* Mobile nav dropdowns activate
*/