Shrinking Sticky Navigation Bar with jQuery - prettySticky

File Size: 2.13 MB
Views Total: 10126
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
Shrinking Sticky Navigation Bar with jQuery - prettySticky

prettySticky is a jQuery based sticky header navigation that shrinks to a smaller menu bar with active anchor link highlighting as you scroll down the page. You can also click the anchor links to scroll to desired sections with smooth scrolling effects based on jQuery smooth scroll plugin.

How to use it:

1. Include the jQuery prettySticky plugin's stylesheet in the head section.

<link rel="stylesheet" href="css/prettySticky.css">

2. Create a sticky header navigation as follow:

  <div class="container">
    <div> <a href="#top"><img src="logo.png" alt="Logo" class="logo"></a> </div>
    <div class="menu">
      <ul class="nav">
        <li class="nav"><a href="#section-1">Section 1</a></li>
        <li class="nav"><a href="#section-2">Section 2</a></li>
        <li class="nav"><a href="#section-3">Section 3</a></li>
        <li class="nav"><a href="#section-4">Section 4</a></li>
        <li class="nav"><a href="#section-5">Section 5</a></li>

3. Create content sections corresponding to the anchor links created in the previous step.

<section id="section-1">

<section id="section-2">

<section id="section-3">

<section id="section-4">

<section id="section-5">

3. Include the latest jQuery library together with prettySticky.js and jquery.smooth-scroll.min.js at the bottom of your web page.

<script src=""></script>
<script src="scripts/prettySticky.js"></script>
<script src="scripts/jquery.smooth-scroll.min.js"></script>

4. Active the shrinking navigation bar by calling the function on the anchor links.

  $(".nav a").smoothScroll({
    offset: -$("nav").outerHeight()

This awesome jQuery plugin is developed by MoyaMiller. For more Advanced Usages, please check the demo page or visit the official website.