stick anything me - Free Download Stick Anything You Want To The Top On Scroll - jQuery StickMe

Free Download Stick Anything You Want To The Top On Scroll – jQuery StickMe

Posted on

This time I will share jQuery Plugin and tutorial about Stick Anything You Want To The Top On Scroll – jQuery StickMe, hope it will help you in programming stack.

stick anything me - Free Download Stick Anything You Want To The Top On Scroll - jQuery StickMe
File Size: 67.1 KB
Views Total: 497
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

StickMe is a lightweight and simple-to-use jQuery Sticky Element plugin that makes any elements (e.g. header navigation, sidebar widget) fixed on the top when you scroll past them.

How to use it:

1. Load the minified version of the StickMe plugin after loading the latest jQuery JavaScript library.

1 <script src="/path/to/cdn/jquery.min.js"></script>
2 <script src="/path/to/dist/js/jquery.stickme.js"></script>

2. Add the CSS class ‘stickme’ to the target element which should be Stick on page scroll.

1 <nav class="stickme">
2   I'm a sticky navigation
3 </nav>
4  
5 <aside class="stickme">
6   I'm a sticky sidebar widget
7 </aside>

3. Call the function and the plugin will do the rest.

1 $(function(){
2   $.stickme();
3 });

4. You can also initialize the plugin without the ‘stickme’ class.

1 <nav class="nav">
2   I'm a sticky navigation
3 </nav>
4  
5 <aside class="aside">
6   I'm a sticky sidebar widget
7 </aside>
1 $.stickme({
2   target: $('.nav')
3 });
4  
5 $('.aside').stickme();

5. Determine the distance from the top when the element gets fixed. Default: 0.

1 $('.aside').stickme({
2   top: 10
3 });

6. Destroy the plugin.

1 var stickedElement = $('.aside').stickme();
2  
3 stickedElement.destroy();

7. Callback functions which will be fired depending on the current sticky status.

1 $('.aside').stickme({
2   onStick: function(e, target) {
3     // do something
4   },
5   onUnstick: function(e, target) {
6     // do something
7   }
8 });

8. Event handlers.

01 var stickedElement = $('.aside').stickme();
02  
03 stickedElement.on('onStick', function(e, target) {
04   // do something
05 });
06  
07 stickedElement.on('onUnStick', function(e, target) {
08   // do something
09 });
10  
11 stickedElement.on('onDestroy', function(e, target) {
12   // do something
13 });

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

source : jquery.net