A jQuery plugin to easily add functionality to fix elements to the top of the page on scroll.
Include script after the jQuery library:
<script type="text/javascript" src="/path/to/jquery-sticky.js"></script>
$('.menu').sticky( options )
An optional class to be added to the element.
stickyClass: 'sticky'
An optional class to be added to the generated anchor.
anchorClass: 'sticky-anchor'
Set the class that will be added to the element when it is fixed to the top of the page.
activeClass: 'active'
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
- If the height of the sticky element is changed (for example when active) the anchor retains the original height
MIT License (c) Bruno Tarmann & Gareth Nolan