Giter Site home page Giter Site logo

sirithink / single-page-nav Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chriswojcik/single-page-nav

0.0 2.0 0.0 60 KB

jQuery plugin that provides smooth scrolling and advanced navigation for single page websites.

Home Page: http://chriswojcik.net/demos/single-page-nav/

single-page-nav's Introduction

Single Page Nav

Apply the 'singlePageNav' function to a container element. Clicking on any links within the container will cause an animated scroll down to the element whose ID is identified by that link's "hash" (if it exists). The currently highlighted link in the nav bar will also cycle as the user scrolls down the page (useful with a fixed-position nav bar. Intended for use on single page websites, such as a portfolio.

Bug reports and pull requests more than welcome. This was my first plugin release.

Live demo: http://chriswojcik.net/demos/single-page-nav/

Features

  • The coordinates of each target element are determined dynamically, resizing the browser or appending content to a section will not break the plugin.
  • Configurable options.

Sample Use

$('#navigation-bar').singlePageNav();

Options

  • 'offset' - An offset in pixels above the target element when scrolling (useful for accounting for the height of a "sticky navigation bar", see the demo)
  • 'threshold' - The distance above each section in pixels when the "current" link in the nav bar will change.
  • 'speed' - The animated scroll speed in milliseconds.
  • 'currentClass' - The class to apply to the link in the nav bar corresponding to the active section on the page.
  • 'updateHash' - If true, updates the browser's url to include the hash when clicking on the links. (Default is false)

Limitations

  • The order of the links in the navigation bar MUST match the order of the sections as laid out on the page or unexpected behavior will occur.

TODO (future updates)

  • Add support for horizontal scrolling sites.
  • Provide ability to filter out links, such as external urls

References

The functionality of this plugin is admittedly similar to some others. But it was my first plugin, so be kind. Here are a few links to such plugins if you find them more helpful.

single-page-nav's People

Watchers

 avatar  avatar

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.