jQuery Plugin For Fixed Headings On Page Scroll - Sticky Headings
File Size: | 5.5 KB |
---|---|
Views Total: | 383 |
Last Update: | |
Publish Date: | |
Official Website: | Go to website |
License: | MIT |

Sticky Headings is a very small jQuery plugin which makes heading elements (or any other elements you prefer) fixed at the top of the webpage as you scroll past them.
How to use it:
1. To use this plugin, just include jQuery library and the sticky-headings.js
script before the closing body tag.
<script src="//code.jquery.com/jquery.min.js"></script> <script src="sticky-headings.js"></script>
2. Add the CSS class of 'sticky-header' to the heading elements:
<h2 class="sticky-header">Section 1</h2> ... <h2 class="sticky-header">Section 2</h2> ... <h2 class="sticky-header">Section 3</h2> ...
3. Call the function to initialize the plugin.
$('.sticky-header').stickyheadings();
4. Specify how far down the sticky element is from the top.
$('.sticky-header').stickyheadings({ offset: 20 });
This awesome jQuery plugin is developed by nareshnootoo. For more Advanced Usages, please check the demo page or visit the official website.