content logo

Bootstrap Sliders:

A Responsive Bootstrap5 Carousel Multiple Frames

If you like to add different photos to your website, look at this post carefully. This post can help you to organize your page beautifully. Here, we have prepared A Responsive Bootstrap Carousel Multiple Frames with a different theme. You can use this Bootstrap Carousel Code to add several photos and gifts to your website. As a result, you can save space and use many images in a small section. In addition to its functionality, this Carousel Slider Code has an attractive theme. So, you can use it and gain more visitors to your website.

As you see from the below preview, this HTML Mini Slider Code contains three pictures with a gray background. Two of these images are at the top of the page and the last one is a gif with an animating effect. You can change these images and gifs based on your desire. By looking at this preview, you realize that a thin white line separates these images and helps you distinguish them together. There are two icons at the bottom of the Bootstrap Thumbnail Slider that show two arrows. After clicking on these arrows, you can move to another page with different images. Download and use this code to attract new visitors to your website.

 

#

Bootstrap Carousel Code

#

Carousel Slider Code

#

HTML Mini Slider Code

#

Bootstrap Thumnail Slider

<!-- This script got from frontendfreecode.com -->
<br><br>
<div class="container-sm mt-2 mb-2 bg-light">
    <div class="row mb-2">
        <div class="col-2 col-sm-3">
            &emsp;
        </div>
        <div class="col-8 col-sm-6 col-md-12 my-bg-light rounded shadow-lg text-start">
            <div class="text-left mb-2 border-bottom">
                <p class="fw-light text-muted ms-3">Custom Boostrap Carousel</p>
            </div>
            <div class="text-center">
                <a id="anchor-0" href="#" target="_blank">
                    <img id="img-0" class="my-bg-light rounded shadow-sm" src="#" alt="Img A">
                </a>
                <a id="anchor-1" href="#" target="_blank">
                    <img id="img-1" class="my-bg-light rounded shadow-sm" src="#" alt="Img B">
                </a>
                <a id="anchor-2" href="#" target="_blank">
                    <img id="img-2" class="my-bg-light rounded shadow-sm" src="#" alt="Img C">
                </a>
            </div>
            <div class="text-end border-top mb-2 mt-2">
                <div class="btn-group me-3">
                    <button id="arrowLeftBtn" type="button" class="btn btn-sm">
                        <i class="fa fa-arrow-circle-left"></i>
                    </button>
                    <button id="arrowRightBtn" type="button" class="btn btn-sm">
                        <i class="fa fa-arrow-circle-right"></i>
                    </button>
                </div>
            </div>
        </div>
        <div class="col-2 col-sm-3">
            &emsp;
        </div>
    </div>
</div>
<br><br><a style="font-size: 8pt; text-decoration: none" target="_blank" href="http://frontendfreecode.com">Free Frontend</a>
                                                                            
img {
  width: 200px;
  height: 200px;
  object-fit: cover;
}
.my-bg-light {
  background-color: #CDCBCB;
}
.btn:focus {
  outline: none;
  box-shadow: none;
}
a {
  text-decoration: none !important;
}
.container-sm {
  max-width: 648px;
  margin: 0 auto;
}
class Carousel {
    constructor(imageLinks) {
        this.imageLinks = imageLinks;
        this.imageIndex = 1;
    }
    getCurrentSelection() {
        return this.imageLinks.slice(this.imageIndex - 2, this.imageIndex + 1);
    }
    rotateRight() {
        if (this.imageIndex < this.imageLinks.length - 1) {
            this.imageIndex++;
            return this.getCurrentSelection();
        }
        return [];
    }
    rotateLeft() {
        if (this.imageIndex > 2) {
            this.imageIndex--;
            return this.getCurrentSelection();
        }
        return [];
    }
}
function main() {
    // Add 3 or more links/images below:
    const links = [
        {
            anchorlink: 'http://frontendfreecode.com/',
            imageLink: 'http://frontendfreecode.com/img/coffee.jpg',
        }, {
            anchorlink: 'http://frontendfreecode.com/',
            imageLink: 'http://frontendfreecode.com/img/two-people.png',
        }, {
            anchorlink: 'http://frontendfreecode.com/',
            imageLink: 'http://frontendfreecode.com/img/winter-2021-northern-hemisphere.gif',
        }, {
            anchorlink: 'http://frontendfreecode.com/',
            imageLink: 'http://frontendfreecode.com/img/teachers-day-2018-turkey.gif',
        }, {
            anchorlink: 'http://frontendfreecode.com/',
            imageLink: 'http://frontendfreecode.com/img/celebrating-mensch-argere-dich-nicht.gif',
        }, {
            anchorlink: 'http://frontendfreecode.com/',
            imageLink: 'http://frontendfreecode.com/img/summer-2021-southern-hemisphere.gif',
        }, {
            anchorlink: 'http://frontendfreecode.com/',
            imageLink: 'http://frontendfreecode.com/img/georges-seurats-162nd-birthday.gif',
        }, {
            anchorlink: 'http://frontendfreecode.com/',
            imageLink: 'http://frontendfreecode.com/img/stay-and-play-at-home-with-popular-past-google-doodles-coding.gif',
        },
    ];
    const updateUI = ((updatedLinks) => {
        for (const [index, linkPair] of updatedLinks.entries()) {
            document.getElementById(`anchor-${index}`).href = linkPair.anchorlink;
            document.getElementById(`img-${index}`).src = linkPair.imageLink;
        }
    });
    const carousel = new Carousel(links);
    updateUI(carousel.rotateRight());
    document.getElementById('arrowLeftBtn').addEventListener('click', (ev) => {
        ev.preventDefault();
        updateUI(carousel.rotateLeft());
    });
    document.getElementById('arrowRightBtn').addEventListener('click', (ev) => {
        ev.preventDefault();
        updateUI(carousel.rotateRight());
    });
}
main();
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.0.2/css/bootstrap.min.css'>
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css'>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- This script got from frontendfreecode.com -->

<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.0.2/css/bootstrap.min.css'>
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css'>
<style>
img {
  width: 200px;
  height: 200px;
  object-fit: cover;
}
.my-bg-light {
  background-color: #CDCBCB;
}
.btn:focus {
  outline: none;
  box-shadow: none;
}
a {
  text-decoration: none !important;
}
.container-sm {
  max-width: 648px;
  margin: 0 auto;
}
</style>

</head>
<body>
<br><br>
<div class="container-sm mt-2 mb-2 bg-light">
    <div class="row mb-2">
        <div class="col-2 col-sm-3">
            &emsp;
        </div>
        <div class="col-8 col-sm-6 col-md-12 my-bg-light rounded shadow-lg text-start">
            <div class="text-left mb-2 border-bottom">
                <p class="fw-light text-muted ms-3">Custom Boostrap Carousel</p>
            </div>
            <div class="text-center">
                <a id="anchor-0" href="#" target="_blank">
                    <img id="img-0" class="my-bg-light rounded shadow-sm" src="#" alt="Img A">
                </a>
                <a id="anchor-1" href="#" target="_blank">
                    <img id="img-1" class="my-bg-light rounded shadow-sm" src="#" alt="Img B">
                </a>
                <a id="anchor-2" href="#" target="_blank">
                    <img id="img-2" class="my-bg-light rounded shadow-sm" src="#" alt="Img C">
                </a>
            </div>
            <div class="text-end border-top mb-2 mt-2">
                <div class="btn-group me-3">
                    <button id="arrowLeftBtn" type="button" class="btn btn-sm">
                        <i class="fa fa-arrow-circle-left"></i>
                    </button>
                    <button id="arrowRightBtn" type="button" class="btn btn-sm">
                        <i class="fa fa-arrow-circle-right"></i>
                    </button>
                </div>
            </div>
        </div>
        <div class="col-2 col-sm-3">
            &emsp;
        </div>
    </div>
</div>
<br><br><div id="bcl"><a style="font-size:8pt;text-decoration:none;" href="http://www.devanswer.com">Free Frontend</a></div>
<script>
class Carousel {
    constructor(imageLinks) {
        this.imageLinks = imageLinks;
        this.imageIndex = 1;
    }
    getCurrentSelection() {
        return this.imageLinks.slice(this.imageIndex - 2, this.imageIndex + 1);
    }
    rotateRight() {
        if (this.imageIndex < this.imageLinks.length - 1) {
            this.imageIndex++;
            return this.getCurrentSelection();
        }
        return [];
    }
    rotateLeft() {
        if (this.imageIndex > 2) {
            this.imageIndex--;
            return this.getCurrentSelection();
        }
        return [];
    }
}
function main() {
    // Add 3 or more links/images below:
    const links = [
        {
            anchorlink: 'http://frontendfreecode.com/',
            imageLink: 'http://frontendfreecode.com/img/coffee.jpg',
        }, {
            anchorlink: 'http://frontendfreecode.com/',
            imageLink: 'http://frontendfreecode.com/img/two-people.png',
        }, {
            anchorlink: 'http://frontendfreecode.com/',
            imageLink: 'http://frontendfreecode.com/img/winter-2021-northern-hemisphere.gif',
        }, {
            anchorlink: 'http://frontendfreecode.com/',
            imageLink: 'http://frontendfreecode.com/img/teachers-day-2018-turkey.gif',
        }, {
            anchorlink: 'http://frontendfreecode.com/',
            imageLink: 'http://frontendfreecode.com/img/celebrating-mensch-argere-dich-nicht.gif',
        }, {
            anchorlink: 'http://frontendfreecode.com/',
            imageLink: 'http://frontendfreecode.com/img/summer-2021-southern-hemisphere.gif',
        }, {
            anchorlink: 'http://frontendfreecode.com/',
            imageLink: 'http://frontendfreecode.com/img/georges-seurats-162nd-birthday.gif',
        }, {
            anchorlink: 'http://frontendfreecode.com/',
            imageLink: 'http://frontendfreecode.com/img/stay-and-play-at-home-with-popular-past-google-doodles-coding.gif',
        },
    ];
    const updateUI = ((updatedLinks) => {
        for (const [index, linkPair] of updatedLinks.entries()) {
            document.getElementById(`anchor-${index}`).href = linkPair.anchorlink;
            document.getElementById(`img-${index}`).src = linkPair.imageLink;
        }
    });
    const carousel = new Carousel(links);
    updateUI(carousel.rotateRight());
    document.getElementById('arrowLeftBtn').addEventListener('click', (ev) => {
        ev.preventDefault();
        updateUI(carousel.rotateLeft());
    });
    document.getElementById('arrowRightBtn').addEventListener('click', (ev) => {
        ev.preventDefault();
        updateUI(carousel.rotateRight());
    });
}
main();
</script>

</body>
</html>
Preview