Create Jquery Sticky HeaderAfter Scroll

Category: Navigation | July 17, 2018
Jquery sticky header after scroll
Author: Juan Gallardo
Official Page: Go to Website
Last Update:May 31, 2019

Previously, we have shared an auto-hide header on scroll and here let’s have a look Jquery sticky header which stays at top of the page after scroll.

It is a simple sticky header which always stays at the top area of the page. It has a main banner where you can include some info and a navigation bar which is basically sticky.

Make Sticky Header using Jquery

To implement you need to call the main Jquery file. Most of the themes already have it. You also need to add sticky.css or copy the style into your theme.

<link rel="stylesheet" type="text/css" href="sticky.css" />
<script src=""></script>

Next thing is simple and all you have to write basic HTML.

    <div class="header-banner">
        <h1>Jquery sticky header</h1>
    <div class="clear"></div>
        <div class="site-title">Frontendscript</div>
            <li><a href="/archive">Archive</a></li>
            <li><a href="/events">Events</a></li>
            <li><a href="/contact">Contact</a></li>

The Javascript is easy to understand and write on a few lines.

<script type="text/javascript">
	if ($(window).scrollTop() >= 300) {
		$('nav div').addClass('visible-title');
	else {
		$('nav div').removeClass('visible-title');

You May Also Like

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.