Search code examples
jquery-mobilejcarouselcarouselswipe

jQuery Mobile Slider / Carousel


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?


Solution

  • 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