This time I will share jQuery Plugin and tutorial about Simple & Versatile Sticky Element Plugin For jQuery – scroll-follow, hope it will help you in programming stack.
scroll-follow is a simple yet highly customizable and mobile-friendly jQuery plugin to create sticky elements that follow as you scroll down the page. Ideal for sticky navigation, fixed sidebar and more.
Basic usage:
1. Load the main JavaScript file jquery.simple-scroll-follow.js
after jQuery library and we’re ready to go.
1 |
< script src = "//code.jquery.com/jquery-3.2.1.slim.min.js" ></ script > |
2 |
< script src = "jquery.simple-scroll-follow.js" ></ script > |
2. The JavaScript to make your sidebar sticky on vertical page scrolling.
3. The JavaScript to make your sidebar sticky within a specific container.
1 |
$( '.sidebar' ).simpleScrollFollow({ |
4. Disable the ‘sticky’ functionality when the screen size is less than 992px.
1 |
$( '.sidebar' ).simpleScrollFollow({ |
5. Enable/disable the ‘sticky’ functionality:
2 |
$( '.sidebar' ).simpleScrollFollow( 'setEnabled' , true ); |
5 |
$( '.sidebar' ).simpleScrollFollow( 'setEnabled' , false ); |
Changelog:
2018-08-12
2017-05-14
This awesome jQuery plugin is developed by sutara79. For more Advanced Usages, please check the demo page or visit the official website.