Meet Unslider, the simplest jQuery slider

In short, Unslider is the quickest and most straightforward way to have a slider up and running on your website. All it takes is a bit of valid markup, jQuery and some additional CSS. Then, Unslider takes over and does the rest.

Sure, Unslider is small, but that’s its unique value proposition. Both flexible and extensible, it allows designers the freedom to pretty much alter anything they want through options/settings, methods or callback events.

Let’s look at some of its features…

Automatic support

Unslider automatically supports various scripts when designers reference the <script> tag before Unslider.

Right-to-left (RTL) support – Add dir=“rtl” to make Unslider change the slide direction

Velocity.js – This is a quicker alternative to jQuery’s .animate(). If sliders are a tad sluggish, add Velocity for a noticeable improvement.

jquery.swipe.js – Include swipe support for desktop and mobile to sliders.


Unslider comes with some methods you can utilize to control sliders and two ways of approaching this.

Method 1‘unslider’).methodName();‘unslider’).methodName(‘arguments,’ ‘go,’ ‘here’);

Method 2 (the shorthand version)


init – Set up everything with your slider. This is automatically called as you set up .unslider() for the first time, yet if there are layout problems, or you’d like to reinitiate the slider, you can call it here.

calculateSlides – Call the following to avoid things breaking when a slide’s added or removed:

var slider = $(‘.my-slider’).unslider();
// I don’t like this last slide. Let’s get rid of it
// Let’s recalculate Unslider so it knows what’s going on

start – Have the slider move itself between slides. Uses the object option to set delay between slides.

stop – Stop the slider from moving itself between slides. Stops the auto-playing.

destroyKeys – Remove the keyboard shortcut handlers for sliders.

initKeys – Add keyboard shortcut support manually. May be used after destroyKeys to restore keyboard shortcut support.

initSwipe – Manually set up swipe functionality. Add it automatically by including jquery.event.move and jquery.event.swipe in the code. To add it after page load, call initSwipe this way:

// Let’s say we want to use $.getScript to load our scripts for some reason
var scripts = [
// Once our script is loaded, we can initSwipe to add swipe support
$.getScript(scripts[1], function() {
destroySwipe – Remove swipe support.

setIndex – Set the current index as well as navigation for Unslider. You won’t be able to move the slider. To move to a specific slide, rely on animate().

animate – Move to a specific slide, update any navigation, and fire an unslider.change event. Do this:

//  Our trusty slider!
var slider = $('.slider').unslider();
//  Move to the first slide
//  Move to the third slide
//  Remember, slides are zero-indexed so 0 is first slide, 1 is second, etc.
//  Move to the last slide
//  Move to the last slide and add a direction

next – Move to the next slide, manually.
prev – Same thing as .unslider(‘next’), yet in the other direction. Manually moves the slider backwards.

Unslider is now available for download on its websites as well as on GitHub.

Marc’s a copywriter who covers design news for Web Designer Depot. Find out more about him at More articles by Marc Schenker
Home CSS Deals HTML HTML5 Java JavaScript jQuery Miscellaneous Mobile MySQL News PHP Resources Security Snippet Tools Tutorial Web Development Web Services WordPress