1.0.0 • Published 8 years ago
sticky-with-it v1.0.0
Sticky
A simple and lightweight jQuery plugin to quickly and easily make elements sticky when they're about to scroll out of the viewport.
Installation
Include either the production version or the development version of the plugin in your file:
<!-- Development version -->
<script src="jquery.sticky-with-it.js"></script>
<!-- Production version (minified) -->
<script src="jquery.sticky-with-it.min.js"></script>
Usage
Use the sticky()
method the jQuery selectors you wish to make sticky:
$('#element').sticky();
If you wish to change any of the default settings, you can pass them into the sticky()
method as an object:
$('#element').sticky({
'class': 'i-am-sticky',
'offset': 100
});
Options
Available configuration options:
class
: (default: is-sticky
) Class that will be added to element when it becomes sticky.
offset
: (default: 0
) Add an offset to top of the viewport.
1.0.0
8 years ago