Minimalist jQuery Fixed Position Top Bar Plugin - Sticky

File Size: 4.16 KB
Views Total: 2514
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Minimalist jQuery Fixed Position Top Bar Plugin - Sticky

Sticky is a yet another jQuery fixed position plugin that provides a simple way to create html elements fixed on top when scrolled.

Basic Usage:

1. Create a fixed position element

<header> My header menu </header>

2. Load jQuery library and jQuery Sticky at the bottom of your page

<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="jquery-sticky.js"></script> 

3. Call the plugin with optional settings

<script>
(function(){
$('header').sticky({
stickyClass: 'sticky', // 
anchorClass: 'sticky-anchor', // An optional class to be added to the generated anchor.
activeClass: 'active' // Set the class that will be added to the element when it is fixed to the top of the page.
});
}());
</script>

4. Style the element

header.active {
...
}

This awesome jQuery plugin is developed by garethdn. For more Advanced Usages, please check the demo page or visit the official website.