Fix Nav-Bar when link to section of page (#486)
This commit is contained in:
committed by
GitHub
parent
bc0b69d726
commit
d1bc8e2f4c
+14
-8
@@ -1,13 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
(function ($) {
|
||||
jQuery(document).ready(function () {
|
||||
|
||||
// change navbar style on scroll
|
||||
// ==================================================
|
||||
// When the user scrolls down 80px from the top of the document, resize the navbar's padding and the logo's font size
|
||||
// $.onscroll = function() {scrollFunction()};
|
||||
$(document).scroll(function () {
|
||||
const updateNavBar = () => {
|
||||
if ($(document).scrollTop() > 40) {
|
||||
$('#top-navbar').removeClass('initial-navbar');
|
||||
$('#top-navbar').addClass('final-navbar shadow');
|
||||
@@ -36,6 +29,17 @@
|
||||
$('#logo').attr("src", logoURL);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
(function ($) {
|
||||
jQuery(document).ready(function () {
|
||||
|
||||
// change navbar style on scroll
|
||||
// ==================================================
|
||||
// When the user scrolls down 80px from the top of the document, resize the navbar's padding and the logo's font size
|
||||
// $.onscroll = function() {scrollFunction()};
|
||||
$(document).scroll(function () {
|
||||
updateNavBar();
|
||||
});
|
||||
|
||||
// Creates a click handler to collapse the navigation when
|
||||
@@ -46,6 +50,8 @@
|
||||
$('.navbar-collapse').collapse('hide');
|
||||
});
|
||||
}
|
||||
|
||||
updateNavBar();
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
||||
Reference in New Issue
Block a user