GithubHelp home page GithubHelp logo

scrollnav's Introduction

ScrollNav jQuery Plugin

About

ScrollNav is a small, lightweight jQuery plugin for adding an auto-hiding navbar to websites. It works best with BootStrap based websites, but can easily be dropped into any site with a fixed or static navbar.

ScrollNav will make your navbar act as a static navbar when scrolling down the page, and an absolutly positioned navbar that was just out of sight when scrolling up the page. Once the navbar is in full view, it will act as a fixed element at the top of the page.

You can view a demo here

Usage

Given this markup:

<html>
  <!-- jQuery/ScrollNav JS includes -->
  <body>
    <div id="navbar" style="position: fixed;">
      <a class="brand">Navbar Example</a>
      <ul>
        <li><a href="www.google.com">Obscure Website</a></li>
        <li><a href="www.reddit.com">Time Sinks</a></li>
      </ul>
    </div>
  </body>
</html>

The resulting call to the ScrollNav plugin would be such:

$("#myNavBar").scrollNav();

If you were using a static navbar, add the navbar's height in padding to the top of the document body (to avoid the navbar overlapping body content).

Bootstrap Compatibility

Given that I originaly wrote the plugin with Bootstrap in mind, it should work just dropped into place when used with a bootstrap navbar. Mobile compatibility took an ugly hack (namley injecting a bit of css into the DOM), but it works. To enable bootstrap mobile compatibility, call the plugin with

$("#myNavBar").scrollNav({"bootstrap_mobile": true});

scrollnav's People

Contributors

dymk avatar

Stargazers

Odyseus avatar mz avatar Brian Ray avatar  avatar Pedro Coutinho avatar Jonathan Barratt avatar

Watchers

Jonathan Barratt avatar James Cloos avatar  avatar Odyseus avatar Sang avatar

scrollnav's Issues

scroll-top issue in mac-chrome

There is a problem with this plugin when i scroll up to top instantly on mac-chrome browser.. the header hides. Experienced the bug in your demo as well

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.