Fix Nav-Bar when link to section of page (#486)
This commit is contained in:
parent
bc0b69d726
commit
d1bc8e2f4c
1 changed files with 34 additions and 28 deletions
|
@ -1,13 +1,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
(function ($) {
|
const updateNavBar = () => {
|
||||||
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 () {
|
|
||||||
if ($(document).scrollTop() > 40) {
|
if ($(document).scrollTop() > 40) {
|
||||||
$('#top-navbar').removeClass('initial-navbar');
|
$('#top-navbar').removeClass('initial-navbar');
|
||||||
$('#top-navbar').addClass('final-navbar shadow');
|
$('#top-navbar').addClass('final-navbar shadow');
|
||||||
|
@ -36,6 +29,17 @@
|
||||||
$('#logo').attr("src", logoURL);
|
$('#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
|
// Creates a click handler to collapse the navigation when
|
||||||
|
@ -46,6 +50,8 @@
|
||||||
$('.navbar-collapse').collapse('hide');
|
$('.navbar-collapse').collapse('hide');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateNavBar();
|
||||||
});
|
});
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue