Download
Demo
- Overview
- Documents
User Rating: 0/5 ( 0 votes)
Your Rating:
Scroller is a jQuery plugin for replacing default browser scrollbars.
Source: formstone.it
1. INCLUDE JS AND CSS FILES
<script src="jquery.js"></script> <script src="jquery.fs.scroller.js"></script> <link href="jquery.fs.scroller.css" rel="stylesheet">
2. HTML
<div class="scrollbar" data-scroller-options='{"customClass":"advanced","trackMargin":"15","handleSize":"40"}'> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla porta aliquet gravida. Aenean pulvinar blandit orci vel fermentum. Phasellus viverra pulvinar viverra. Quisque et sagittis ante. Nulla sem neque, fermentum at laoreet vel, rhoncus sit amet nisl. Donec consectetur urna ac massa placerat ac pharetra sem mollis. Integer nibh urna, placerat vel placerat in, tempor at nisi. Aenean rutrum, enim sit amet rutrum fermentum, magna justo volutpat massa, lacinia adipiscing nisl magna eget nibh. In auctor, nibh eget faucibus tristique, arcu turpis molestie orci, placerat suscipit diam nibh et erat. Curabitur tempus lectus quis odio ornare porta.</p> </div>
3. JAVASCRIPT
$(".scrollbar").scroller({ customClass: "advanced", trackMargin: 15, handleSize: 40 });
4. OPTIONS
Options are set by passing a valid options object at initialization or to the public "defaults" method. You can also set custom options for a specific instance by attaching a data-boxer-options attribute containing a properly formatted JSON object to the target element.
NAME | TYPE | DEFAULT | DESCRIPTION |
---|---|---|---|
customClass | string | '' | Class applied to instance |
duration | int | 0 | Scroll animation length |
handleSize | int | 0 | Handle size; 0 to auto size |
horizontal | boolean | false | Scroll horizontally |
trackMargin | int | 0 |
5. METHODS
Methods are publicly available to all active instances, unless otherwise stated.
defaults
Sets default plugin options
$.scroller("defaults", opts);
PARAMETER | TYPE | DEFAULT | DESCRIPTION |
---|---|---|---|
opts | object | {} | Options object |
destroy
Removes instance of plugin
$(".target").scroller("destroy");
scroll
Scrolls instance of plugin to element or position
$.scroller("scroll", pos, duration);
PARAMETER | TYPE | DEFAULT | DESCRIPTION |
---|---|---|---|
pos | string || int | null | Target element selector or static position |
duration | int | null | Optional scroll duration |
reset
Resets layout on instance of plugin
$.scroller("reset");