Skip to content

Commit

Permalink
fix: fixed navbar (thx EM)
Browse files Browse the repository at this point in the history
  • Loading branch information
titanism committed Oct 21, 2023
1 parent 2f3ba39 commit 704cf65
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions assets/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,10 @@ const $nav = $('.navbar.fixed-top');
const el = document.querySelector('#freddy');

function navbarScroll() {
if ($(window).scrollTop() >= $nav.outerHeight()) {
if (
$(window).scrollTop() >= $nav.outerHeight() ||
$('.navbar-collapse').hasClass('show')
) {
$nav
.addClass('bg-white navbar-themed bg-themed border-bottom')
.removeClass('text-white');
Expand All @@ -433,6 +436,6 @@ if (el && $nav.length > 0) {
navbarScroll();
$(window).scroll(debounce(navbarScroll, 125));
$('#navbar-header')
.on('show.bs.collapse', navbarScroll)
.on('hide.bs.collapse', navbarScroll);
.on('shown.bs.collapse', navbarScroll)
.on('hidden.bs.collapse', navbarScroll);
}

0 comments on commit 704cf65

Please sign in to comment.