fixed navbar-glitch for edge-case pages
This commit is contained in:
parent
5364aded5c
commit
2063a32bb9
@ -6,7 +6,7 @@
|
|||||||
window.utils.stickynav = function(nav) {
|
window.utils.stickynav = function(nav) {
|
||||||
var ticking = false;
|
var ticking = false;
|
||||||
|
|
||||||
init();
|
init();
|
||||||
function init() {
|
function init() {
|
||||||
nav.style.paddingLeft = document.body.getBoundingClientRect().width < 999 ? '90px' : '';
|
nav.style.paddingLeft = document.body.getBoundingClientRect().width < 999 ? '90px' : '';
|
||||||
window.setTimeout(function() {
|
window.setTimeout(function() {
|
||||||
@ -19,6 +19,7 @@
|
|||||||
// checks scroll direction and shows/hides navbar accordingly
|
// checks scroll direction and shows/hides navbar accordingly
|
||||||
function checkScroll() {
|
function checkScroll() {
|
||||||
var sticky = window.scrollY > 0;
|
var sticky = window.scrollY > 0;
|
||||||
|
sticky = sticky && window.innerHeight < (document.scrollingElement.scrollHeight - 50);
|
||||||
nav.classList.toggle('navbar--sticky', sticky);
|
nav.classList.toggle('navbar--sticky', sticky);
|
||||||
ticking = false;
|
ticking = false;
|
||||||
}
|
}
|
||||||
@ -38,7 +39,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
overflow: hidden;
|
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);
|
box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +80,7 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
height: var(--header-height);
|
height: var(--header-height);
|
||||||
color: var(--color-lightwhite);
|
color: var(--color-lightwhite);
|
||||||
transition: height .2s ease;
|
transition: height .2s cubic-bezier(0.03, 0.43, 0.58, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar__link-label {
|
.navbar__link-label {
|
||||||
@ -138,12 +138,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.navbar--animated {
|
.navbar--animated {
|
||||||
transition: all .2s ease;
|
transition: all .2s cubic-bezier(0.03, 0.43, 0.58, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar__pushdown {
|
.navbar__pushdown {
|
||||||
height: var(--header-height);
|
height: var(--header-height);
|
||||||
transition: height .2s ease;
|
transition: height .2s cubic-bezier(0.03, 0.43, 0.58, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar--sticky + .navbar__pushdown {
|
.navbar--sticky + .navbar__pushdown {
|
||||||
|
|||||||
Reference in New Issue
Block a user