Git Product home page Git Product logo

linkscroller's Introduction

LinkScroller - quick and dirty component that allows for seamless scrolling animation from selected links to indicated DOM element. REQUIRES history.js to work. Remembers browser history via HTML5 pop/pushstate API.

Example available here.

Usage example:

HTML:

 <ul id='nav' class="nav navbar-nav">
          <li class="active"><a data-anchor="home" href="#">Home</a></li>
          <li ><a data-anchor="tools" href="#">Tools</a></li>
          <li ><a data-anchor="apis" href="#">APIs</a></li>
          <li ><a data-anchor="links" href="#">Links</a></li>
  </ul>

Javscript:

// init the linkscroll component
var linkscrollConfig = {};
$( '#nav' ).linkscroll(    linkscrollConfig    );

OPTIONS:

// the selector to look for in self.element
// in our example, it will look for all the 
// anchor tags in $( '#nav' ) by default
linkSelector    :    'a'    
// react only when this (these) event(s) occur
// in our example, it will only animate scrolling 
// on click
linkEvent     :    'click'     
// grab the key from this data-attr
// by default, it will look at data-anchor
// for the IDs of the DOM elements it scrolls to
linkDataAttr  :    'data-anchor'     
 // fired right before animation starts
 // by default, nothing happends
onBeforeAnim  :    -1    
 // fired right after animation states
 // by default, nothing happens
onAfterAnim   :    -1      

linkscroller's People

Contributors

mottaquikarim avatar

Watchers

fjdseven 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.