Skip to content

Instantly share code, notes, and snippets.

@jlazanowski
Last active January 5, 2017 06:15
Show Gist options
  • Select an option

  • Save jlazanowski/6302501 to your computer and use it in GitHub Desktop.

Select an option

Save jlazanowski/6302501 to your computer and use it in GitHub Desktop.
Carousel Swipe support with TouchSwipe
<script>
$(document).ready(function() {
//Enable swiping...
$(".carousel-inner").swipe( {
//Generic swipe handler for all directions
swipeLeft:function(event, direction, distance, duration, fingerCount) {
$(this).parent().carousel('prev');
},
swipeRight: function() {
$(this).parent().carousel('next');
},
//Default is 75px, set to 0 for demo so any distance triggers swipe
threshold:0
});
});
</script>
@gianpaj
Copy link

gianpaj commented Dec 16, 2013

fyi: the behaviour should be the opposite. swipeLeft -> next. swipeRight -> prev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment