Slider beta
11dB
Drag the handle up and down to see it in action.
How-to
Adding a slider to your page can be done in 5 easy steps:
-
Include the script in the
<head>tag of your page:<script type="text/javascript" src="/path/to/javascript/slider.js"> </script> -
Add an empty container
divto the page:<div id="container"></div>
-
Create CSS style declarations for the slider:
div.slider div.thumb { background: url(images/thumb.gif) no-repeat top left; width: 33px; height: 15px; } div.slider div.track { background: url(images/track.gif) no-repeat top left; width: 19px; height: 91px; }Your slider can be any size. The script will automatically adapt.
-
Instantiate a
Sliderobject with the containerdivid and a callback function:function init() { var slider = new Slider("container", onSliderChange); } function onSliderChange(sliderValue) { // do something } -
Call your script once the page has loaded using the
onloadevent handler indocument.body.<body onload="init()">
Browser Support
The slider has been tested on:
- Internet Explorer 5.5+
- Mozilla Firefox 2
- Opera 9.2
- Safari 3 Beta
It probably works on other browsers too. :)