Swiper used by big companies

jQuery Mobile Slider Example with Swiper

Have you ever wondered how have some websites managed to create so well performing mobile slider? The answer is Swiper.

jQuery Mobile Slider is something a lot of new mobile sites use these days to create horizontal sliding effects on their web pages. I have went through all of them to find the best one for my purposes. You can actually use even if you don’t have jQuery but you can surely use it as a plugin. This is the second post in my web slider post series and on this post I’m going to show you an very simple example of mobile optimized and well running slider.

The JavaScript plugin I’m using is called Swiper, and I think a lot of websites use it these days even though they don’t mention it. It is simply great and it is being continuesly developed. It is used by Adobe, BMW, Disney etc. on their mobile websites, so it has quite good customer base. The greatest thing of course is that it’s completely free.

In a mobile slider, I think, we are looking for some specially touch based logic. Like continuous sliding after you release your finger from the screen, or in another words free rolling slider. Swiper can manage to do that and it does it amazingly well. It is at its best on iPhones, but don’t choke it too much with events, on that side it has a lot to work on. I have found it to work on every machine and browser, so it is has great coding.

You can check my example at https://www.lennu.net/demo/swiper/.

Swiper is especially made for mobile browsers and has free rolling option.

Swiper Example

I have gathered here all the materials you need to create your own Swiper. First there is the HTML. The library includes are already in the template so you just need to download the plugin and place the dist folder to the same folder as you have your HTML file. You can download Swiper at https://github.com/nolimits4web/Swiper/archive/v3.0.7.zip.

Remember you don’t actually have to use jQuery but there is jQuery and native plugins on the zip file. In this example we wont be using jQuery because we don’t need it.

There are two places we need to fill in. There first one is the Swiper slides. Add these silder, or any slides you want into the HTML. Just follow the syntax.

At the end we only need to initialize Swiper with our favourite options. I like to use free rolling and looping on my example, but you can find a ton of options from Swiper API. Add this JavaScript to your HTML page.

We have now created ourselves a multi device and multi browser working mobile optimized jQuery Slider! This tutorial has been about how create a very basic slider. There are a lot of work after this to place this to real application or website and style it very well. But with this template you have a very good starting point.

Swiper is truly the best choice at the moment when building a new mobile website or mobile app with HTML5, if you need a well working slider. Please try it, use it, debug it and check out its website at http://www.idangero.us/swiper/.