Skip to content

A jQuery plugin to easily add functionality to fix elements to the top of the page on scroll. See http://garethdn.github.io/jquery-sticky/ for one implementation of jQuery Sticky for a sidebar navigation element

License

Notifications You must be signed in to change notification settings

garethdn/jquery-sticky

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jQuery Sticky Plugin

A jQuery plugin to easily add functionality to fix elements to the top of the page on scroll.

Installation

Include script after the jQuery library:

<script type="text/javascript" src="/path/to/jquery-sticky.js"></script>

Usage

$('.menu').sticky( options )

Options

stickyClass (string)

An optional class to be added to the element.

stickyClass: 'sticky'

anchorClass (string)

An optional class to be added to the generated anchor.

anchorClass: 'sticky-anchor'

activeClass (string)

Set the class that will be added to the element when it is fixed to the top of the page.

activeClass: 'active'

buffer (number)

Option to add a buffer to the top of the sticky element in the form of a number representing the size of the buffer in pixels.

buffer: 20

TODO

  • If the height of the sticky element is changed (for example when active) the anchor retains the original height

License

MIT License (c) Bruno Tarmann & Gareth Nolan

About

A jQuery plugin to easily add functionality to fix elements to the top of the page on scroll. See http://garethdn.github.io/jquery-sticky/ for one implementation of jQuery Sticky for a sidebar navigation element

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •