- Using Window.scrollY to detect whether the page is scrolled or not, then add the corresponding class name.
transition-timing-function: ease-in;
transition: 0.5s;
The above two lines make the navbar fade out when scroll down.
transition-timing-function: ease-in;
transition: 0.5s;
The above two lines make the navbar fade out when scroll down.