jQuery Mobile Slider / Carousel

Fabio B. picture Fabio B. · Nov 22, 2011 · Viewed 19.2k times · Source

I need to make a jQuery "Carousel" pretty similar to the one in this page: http://m.henrys.com/

There are plenty of "carousel" jQuery plugins, but how can I bind a carousel next/prev page action to the "swipe" mobile phone/tablet gesture?

Answer

Leon picture Leon · Nov 28, 2011

Either you use a JQM plugin for that (I've seen some available), or you add your own touch event management and manually call the next/prev on your chosen plugin.

For example,

$(document).swiperight(function(){
  jqPlugin.goPrev();
});

$(document).swipeleft(function(){
  jqPlugin.goNext();
});

More details on JQM events can be found in their documentation