Make the navbar sticky effect smoother
This commit is contained in:
parent
4180752d42
commit
4208fd5e32
|
@ -67,7 +67,7 @@
|
||||||
window.addEventListener("scroll", () => {
|
window.addEventListener("scroll", () => {
|
||||||
const scrollPosition = window.scrollY || document.documentElement.scrollTop;
|
const scrollPosition = window.scrollY || document.documentElement.scrollTop;
|
||||||
const stickyLine = hero.scrollHeight - navbar.scrollHeight;
|
const stickyLine = hero.scrollHeight - navbar.scrollHeight;
|
||||||
if (scrollPosition > stickyLine) {
|
if (scrollPosition > stickyLine + 55) {
|
||||||
navbar.classList.add("nav--sticky");
|
navbar.classList.add("nav--sticky");
|
||||||
} else {
|
} else {
|
||||||
navbar.classList.remove("nav--sticky");
|
navbar.classList.remove("nav--sticky");
|
||||||
|
|
Loading…
Reference in New Issue