Skip to content

Commit

Permalink
Fix Header on PageLoad if scrolled (#784)
Browse files Browse the repository at this point in the history
  • Loading branch information
the-hotmann authored and gilbertsoft committed Nov 19, 2019
1 parent 9d444b1 commit 016bf02
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.

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

17 changes: 6 additions & 11 deletions Resources/Public/JavaScript/Src/bootstrap.stickyheader.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
$(function () {

$(window).on('resize, scroll', function () {
var stickyheaderScrolled = $(window).scrollTop();
if (stickyheaderScrolled > 150) {
$('.navbar-fixed-top').addClass('navbar-transition');
} else {
$('.navbar-fixed-top').removeClass('navbar-transition');
}
});

var stickyheader = document.getElementsByClassName("navbar-fixed-top");
function animateHeader() {
150<window.scrollY ? stickyheader[0].classList.add("navbar-transition") : stickyheader[0].classList.remove("navbar-transition");
}
['scroll', 'resize', 'DOMContentLoaded'].forEach(function(e) {
window.addEventListener(e, animateHeader);
});

0 comments on commit 016bf02

Please sign in to comment.