Small and quick implementation of a CSS-customizable Scrollbar for use in situations where a div with a fixed height contains content that overflows past its boundaries. This implementation is based off of the scrollbar designs found in various places on Facebook, GMail, and Trello.
New: Scrollable now accepts the $$ selector in addition to the regular $
var myScrollable = new Scrollable(element/elements, options);
Fired when the height of the target element changes
onContentHeightChange()
Given a div element with a fixed height and proper overflow (that is, anything besides "scroll"/"auto"):
var myScrollable = new Scrollable( $('elem-id') );
Given more than one element, by passing in a CSS selector:
var myScrollables = new Scrollable( $$('.class') );
A more complex example (an container with multiple ul elements to add scrollbars to):
var myScrollables = new Scrollable( $('container').getElements('ul') );
Saving the resulting object into the target element using the Element Store:
$('container').store('scrollable', new Scrollable( $('container') ));
Note: Like some other plugins (e.g. More/Tips), Scrollable creates an element into the document body. It is recommended that you call terminate(); once you are finished with it. This is only applicable for pages where content is dynamically loaded and unloaded.
I'd like to thank the following contributors for their assistance with debugging, bugfixing, and enhancing Scrollable:
A note on comments here: These comments are moderated. No comments will show up until they are approved. Comments that are not productive (i.e. inflammatory, rude, etc) will not be approved.
Found a bug in this plugin? Please report it this repository's Github Issues.
blog comments powered by Disqus