Skip to content

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion Resources/Public/JavaScript/Src/bootstrap.stickyheader.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ window.addEventListener('DOMContentLoaded', function () {
var stickyheader = document.querySelectorAll(".navbar-fixed-top");
if (stickyheader.length >= 1) {
function animateHeader() {
120 < window.scrollY ? stickyheader[0].classList.add("navbar-transition") : stickyheader[0].classList.remove("navbar-transition");
if (window.scrollY >= stickyheader[0].getBoundingClientRect().bottom &&
!stickyheader[0].classList.contains("navbar-transition")) {
stickyheader[0].classList.add("navbar-transition");
} else if (window.scrollY < stickyheader[0].getBoundingClientRect().bottom &&
stickyheader[0].classList.contains("navbar-transition")) {
stickyheader[0].classList.remove("navbar-transition");
}
}
['scroll', 'resize', 'DOMContentLoaded'].forEach(function (e) {
window.addEventListener(e, animateHeader);
Expand Down