Skip to content

pazguille/sticky

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sticky JS

Elements stick to the top of the viewport when the user scrolls down.

Installation

$ component install pazguille/sticky

See: https://github.com/component/component

Standalone

Also, you can use the standalone version:

<script src="sticky.js"></script>

How-to

sticky(node, {
   boundary: 200,
   fn: function () {}
});
sticky();
sticky(node);
sticky(node, 200);
sticky(node, function () {});

API

sticky([el], [options])

Elements stick to the top of the viewport when the user scrolls down.

  • el: (node || nodeList) [optional] A given node or nodeList.
  • options.boundary: (number) [optional] Pixels from top of window to the element's top.
  • options.fn: (function) [optional] Function to be executed when the element will be fixed.
sticky(node, {
   boundary: 200,
   fn: function () {}
});

sticky.destroy(el)

Elements stick to the top of the viewport when the user scrolls down.

  • el: (node) A given node.
sticky.destroy(node);

Maintained by

License

Licensed under the MIT license.

Copyright (c) 2013 @pazguille.

About

Stick elements to the top of the viewport when the user scrolls down.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published