Nowadays header/footer hide if scroll down is a common style. this style make your website beautiful and hope this article also make easy development for this.
The HTML
<header>Header</header>
<main>Content</main>
<footer>footer</footer>
The CSS
body{
padding-top:50px; /* equal to header height */
}
header{
background:#000;
width:100%;
height:50px;
transition: top 0.7s ease-in;
position:fixed;
left:0;
top:0;
}
.hide-header{
top: -50px; /* equal to header height */
}
The jQuery
var lastScrollTop = 0;
$(window).scroll(function() {
var st = $(this).scrollTop();
if (st > lastScrollTop){
$('header').addClass('hide-header');
} else {
$('header').removeClass('hide-header');
}
lastScrollTop = st;
});
THANKS
More From Oodles
Ready to innovate? Let's get in touch
Request for Proposal
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Balraj Singh
Balraj is a creative UI designer with experience and capabilities to build compelling UI designs for Web and Mobile Applications. Balraj likes playing tech Quiz and loves bike riding.