SimpleSlider
Summary
The SimpleSlider plugin was developed out of the shear need for a slider that is more intuitive to the CSS that is being applied to it. In a project I had for a client, not many other sliders were adapting well with the styling that I needed to apply to it.
Note
If somebody wants to take a look at the code, and tell me why it can’t be possible to run two instances on one page, I’d very much appreciate, and integrate a fix into the code. Thanks!
Download
SimpleSlider 269Demos
Basic — No CSS, no settings
w/CSS — Some CSS, no settings
w/CSS+settings — Some CSS, some settings
Documentation
Base
For the basic implementation, create an element (ie. UL or DIV), and child elements (ie. LI or DIV).
or
Implementation
To add the SimpleSlider, all you need to initially do is add the following code within some SCRIPT tags in the header or body (in addition to having the jQuery library already inserted into the document). There is really only a couple of things that are required for the SimpleSlider to work. The first is that you have a parent element with children elements (review above). The second is that the parent element has a unique ID attribute.
1 2 3 4 5 6 7 | <script type=“text/javascript”> // <![CDATA[ $(function() { $(’#slider’).simpleslider(); }); // ]]> </script> |
Settings
If you wanted to add some settings to further customize your SimpleSlider, following are the settings, their defaults, as well as a brief explanation.
1 2 3 4 5 6 7 8 9 10 11 12 13 | <script type=“text/javascript”> // <![CDATA[ $(function() { $(’#slider’).simpleslider({ auto: false, interval: 2000, speed: 500, direction: ‘horizontal’, buttons: true }); }); // ]]> </script> |
Auto: If set to TRUE, the slider will auto-advance, using the Interval setting.
Interval: The time in milliseconds between each animation, if Auto is set to TRUE.
Speed: The time in milliseconds the animation between slides takes.
Direction: If set to Horizontal, slider will slide from left to right. If set to Vertical the slider will move up and down.
Buttons: If set to FALSE, no buttons will display. If so, it is then recomended that Auto is set to TRUE.
AutoButtonHeight: If set to TRUE, buttons will automatically take heighth of the slider using inline CSS.
CSS
There are a few changes to the DOM that SimpleSlider makes. It creates a naming convention based on the ID of the parent (main) element. To modify the CSS, there are a few hooks that will make coding much easier. The following code assumes that you gave the parent element an ID of “slider”.
1 2 3 4 5 | #slider-wrapper { (none that I can think of) } #slider { background, width|height } #slider .frame { background, padding } input#slider-previous_button { any } input#slider-next_button { any } |
Donate
If you’ve felt this project has benefitted you, you might considering donating. Every cent is very much appreciated!
-
Ish
-
JSTNJNS
-
Bowman
-
JSTNJNS
-
tri
-
JSTNJNS