Responsive Image & Youtube Video Carousel For Bootstrap 4
| File Size: | 3.82 KB |
|---|---|
| Views Total: | 17545 |
| Last Update: | |
| Publish Date: | |
| Official Website: | Go to website |
| License: | MIT |
A small jQuery extension to Bootstrap 4 framework that enables you to insert images as well as Youtube videos into a responsive Bootstrap 4 carousel component.
How to use it:
1. Embed Youtube videos into your Bootstrap 4 carousel by inserting the video ID into the data-video-id attribute as follows:
<div id="carouselExampleControls" class="carousel slide " data-ride="carousel" data-interval="false">
<div class="carousel-inner">
<div class="carousel-item active">
<img class="d-block w-100" src="1.jpg" alt="First slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="2.jpg" alt="Second slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="3.jpg" alt="Third slide">
</div>
<div class="carousel-item">
<div class="carousel-video-inner embed-responsive embed-responsive-16by9">
<div id="video-player" data-video-id="0vrdgDdPApQ"></div>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
2. Load the main JavaScript index.js into your Bootstrap 4 project. That's it.
<link rel="stylesheet" href="/path/to/bootstrap.min.css" /> <script src="/path/to/jquery.min.js"></script> <script src="/path/to/popper.min.js"></script> <script src="/path/to/bootstrap.min.js"></script> <script src="./index.js"></script>
3. Override the default Youtube API parameters.
window.player = new window.YT.Player(video, {
videoId: videoId,
playerVars: {
autoplay: 1,
modestbranding: 1,
rel: 0
// more parameters here
}
});
This awesome jQuery plugin is developed by TheFroy. For more Advanced Usages, please check the demo page or visit the official website.










