BootStrap Carousel (Carousel) support for left and right hand gesture sliding (three kinds) _javascript tips

Source: Internet
Author: User
Tags prev bootstrap carousel

The Bootstrap Carousel (Carousel) plug-in is a flexible, responsive way to add sliders to a site. In addition, the content is flexible enough to be an image, inline frame, video, or whatever type of content you want to place.

Because recently developed projects involve HTML5 development on mobile devices, which requires the implementation of a carousel effect. Then the quickest way, you know (Bootstrap), and then the native Bootstrap of the Carousel.js plugin does not support gestures.

And then...... Find a way to do it yourself, and then, there are the following 3 solutions:

JQuery Mobile (

$ ("#carousel-generic"). Swipeleft (function () {
$ (this). Carousel (' Next ');
$ ("#carousel-generic"). Swiperight (function () {
$ (this). Carousel (' prev ');

TouchSwipe jQuery Plugin (

$ ("#carousel-generic"). Swipe ({
swipeleft:function () {$ (this). Carousel (' Next ');
swiperight:function ( ) {$ (this). Carousel (' prev ');

Hammer.js ( +
Jquery.hammer.js (Https://

$ (' #carousel-generic '). Hammer (). On (' Swipeleft ', function () {
$ (this). Carousel (' Next ');
$ (' #carousel-generic '). Hammer (). On (' Swiperight ', function () {
$ (this). Carousel (' prev ');

It seems a bit overqualified to import the entire jQuery Mobile simply to support sliding gestures (now available in the English text)
The touchswipe on both sides of the clickable button area is not valid, and then the Hammer is selected.

The above is a small set to introduce the Bootstrap Carousel (carousel) to support the method of moving hand gestures (three), I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.