Bootstrap 4 default carousel with swipe and touch gestures

Bootstrap 4 Carousel with swipe
Code Snippet:
Author:
Published: January 19, 2024
Last Updated: January 22, 2024
Downloads: 9,441
License: MIT
Edit Code online: CodeHim
Read More

Bootstrap 4 default carousel with swipe and touch gestures. The plugin add the swipes gesture to command the Bootstrap built in carousel on mobile and touch devices.

Plugin Overview

Plugin: bootstrap-4-carousel-with-swipe
Author: Andrea Rufo
Licence: MIT Licence
Published: January 19, 2024
Repository: Fork on CodePen
Dependencies: jQuery 1.3.1 or Latest version, Bootstrap 3.3.4 or Latest, Prefixfree 1.0.7 and TouchSwipe 1.6.4 or latest.
File Type: zip archive (HTML, CSS & JavaScript)
Package Size: 4 KB

How to Use it:

1. Load the Bootstrap framework, jQuery library, TouchSwipe (jQuery plugin) prefixfree Js into HTML document.

<!--Bootstrap CSS-->
<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css'>

<!--Bootstrap JS-->
<script src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js'></script>

<!--jQuery-->
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>

<!--Touch Swipe-->
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery.touchswipe/1.6.4/jquery.touchSwipe.min.js'></script>

<!--Prefixfree-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>

2. Create HTML structure for Bootstrap built-in Carousel like bellow and add your images links in it.

<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?girl">
      </div>
      <div class="item">
        <img src="https://unsplash.it/1400/600?bikni">
      </div>
      <div class="item">
        <img src="https://unsplash.it/1400/600?beauty">
      </div>
      <div class="item">
        <img src="https://unsplash.it/1400/600?cat">
      </div>
      <div class="item">
        <img src="https://unsplash.it/1400/600?natural">
      </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>

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About CodeHim

Free Web Design Code & Scripts - CodeHim is one of the BEST developer websites that provide web designers and developers with a simple way to preview and download a variety of free code & scripts. All codes published on CodeHim are open source, distributed under OSD-compliant license which grants all the rights to use, study, change and share the software in modified and unmodified form. Before publishing, we test and review each code snippet to avoid errors, but we cannot warrant the full correctness of all content. All trademarks, trade names, logos, and icons are the property of their respective owners... find out more...

Please Rel0ad/PressF5 this page if you can't click the download/preview link

X