Created
April 21, 2018 05:37
-
-
Save barsbek/95a9be868ed8c625339c8fbade0b234e to your computer and use it in GitHub Desktop.
bootstrap: add swiper to carousel
This file contains 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
$('.carousel').each(function () { | |
var $carousel = $(this); | |
var hammertime = new Hammer(this, { | |
recognizers: [ | |
[Hammer.Swipe, { direction: Hammer.DIRECTION_HORIZONTAL }] | |
] | |
}); | |
hammertime.on('swipeleft', function () { | |
$carousel.carousel('next'); | |
}); | |
hammertime.on('swiperight', function () { | |
$carousel.carousel('prev'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment