fixed navbar-glitch for edge-case pages

This commit is contained in:
Felix Hamann 2018-06-10 23:43:03 +02:00
parent 5364aded5c
commit 2063a32bb9
2 changed files with 6 additions and 6 deletions

View File

@ -6,7 +6,7 @@
window.utils.stickynav = function(nav) {
var ticking = false;
init();
init();
function init() {
nav.style.paddingLeft = document.body.getBoundingClientRect().width < 999 ? '90px' : '';
window.setTimeout(function() {
@ -19,6 +19,7 @@
// checks scroll direction and shows/hides navbar accordingly
function checkScroll() {
var sticky = window.scrollY > 0;
sticky = sticky && window.innerHeight < (document.scrollingElement.scrollHeight - 50);
nav.classList.toggle('navbar--sticky', sticky);
ticking = false;
}
@ -38,7 +39,6 @@
}
})();
document.addEventListener('DOMContentLoaded', function() {

View File

@ -17,7 +17,7 @@
top: 0;
left: 0;
overflow: hidden;
transition: height 0.2s ease;
transition: height 0.2s cubic-bezier(0.03, 0.43, 0.58, 1);
box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
}
@ -80,7 +80,7 @@
align-items: center;
height: var(--header-height);
color: var(--color-lightwhite);
transition: height .2s ease;
transition: height .2s cubic-bezier(0.03, 0.43, 0.58, 1);
}
.navbar__link-label {
@ -138,12 +138,12 @@
}
.navbar--animated {
transition: all .2s ease;
transition: all .2s cubic-bezier(0.03, 0.43, 0.58, 1);
}
.navbar__pushdown {
height: var(--header-height);
transition: height .2s ease;
transition: height .2s cubic-bezier(0.03, 0.43, 0.58, 1);
}
.navbar--sticky + .navbar__pushdown {