<div class="container">
  
  <div class="page-header">
    <h1>Bootstrap 3 default carousel with swipe and touch gestures</h1>
    <p class="lead">How to add the swipes gesture to comand the Bootstrap 3 carousel on mobile devices.</p>
    <p>Made by <strong>Andrea Rufo</strong>, more info and tutorial on <a href="http://www.andrearufo.it/">andrearufo.it</a></p>
  </div>
       

  <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
    <!-- Indicators -->
    <ol class="carousel-indicators">
      <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
      <li data-target="#carousel-example-generic" data-slide-to="1"></li>
      <li data-target="#carousel-example-generic" data-slide-to="2"></li>
      <li data-target="#carousel-example-generic" data-slide-to="3"></li>
      <li data-target="#carousel-example-generic" data-slide-to="4"></li>
    </ol>

    <!-- Wrapper for slides -->
    <div class="carousel-inner" role="listbox">
      <div class="item active">
        <img src="https://unsplash.it/1400/600?image=114">
      </div>
      <div class="item">
        <img src="https://unsplash.it/1400/600?image=62">
      </div>
      <div class="item">
        <img src="https://unsplash.it/1400/600?image=315">
      </div>
      <div class="item">
        <img src="https://unsplash.it/1400/600?image=622">
      </div>
      <div class="item">
        <img src="https://unsplash.it/1400/600?image=401">
      </div>
    </div>

    <!-- Controls -->
    <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
      <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
      <span class="sr-only">Previous</span>
    </a>
    <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
      <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
      <span class="sr-only">Next</span>
    </a>
  </div>

</div>
/*

Made by Andrea Rufo
www.andrearufo.it

     ༼ つ ◕_◕ ༽つ

*/
View Compiled
/*

dependencies:

//cdnjs.cloudflare.com/ajax/libs/jquery.touchswipe/1.6.4/jquery.touchSwipe.min.js
//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js
//cdnjs.cloudflare.com/ajax/libs/jquery.touchswipe/1.6.4/jquery.touchSwipe.min.js

*/

$(".carousel").swipe({

  swipe: function(event, direction, distance, duration, fingerCount, fingerData) {

    if (direction == 'left') $(this).carousel('next');
    if (direction == 'right') $(this).carousel('prev');

  },
  allowPageScroll:"vertical"

});

External CSS

  1. //maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css

External JavaScript

  1. //cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js
  2. //maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js
  3. //cdnjs.cloudflare.com/ajax/libs/jquery.touchswipe/1.6.4/jquery.touchSwipe.min.js