Elements stick to the top of the viewport when the user scrolls down.
$ component install pazguille/sticky
See: https://github.com/component/component
Also, you can use the standalone version:
<script src="sticky.js"></script>
sticky(node, {
boundary: 200,
fn: function () {}
});
sticky();
sticky(node);
sticky(node, 200);
sticky(node, function () {});
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 () {}
});
Elements stick to the top of the viewport when the user scrolls down.
el
: (node) A given node.
sticky.destroy(node);
- Guillermo Paz (Front-end developer | Web standards lover)
- E-mail: [email protected]
- Twitter: @pazguille
- Web: http://pazguille.me
Licensed under the MIT license.
Copyright (c) 2013 @pazguille.