Last active
January 5, 2017 06:15
-
-
Save jlazanowski/6302501 to your computer and use it in GitHub Desktop.
Carousel Swipe support with TouchSwipe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
fyi: the behaviour should be the opposite. swipeLeft -> next. swipeRight -> prev