Images Slider in CSS | Image Slider HTML CSS | Image Slider or Slideshow
# To create Images Slider in CSS | Image Slider HTML CSS | Image Slider or Slideshow Select Menu using JavaScript, you can use a combination of HTML, CSS, and JavaScript to create Images Slider in CSS | Image Slider HTML CSS | Image Slider or Slideshow Select Menu and apply a tilt effect to it. Here's an example:
1. First, create a container element in HTML for the Images Slider:
<div class="container text-center">
<div class="row mx-auto my-auto">
<div id="myCarousel" class="carousel slide w-100" data-ride="carousel">
<div class="carousel-inner w-100" role="listbox">
<div class="carousel-item active">
<div class="col-lg-4 col-md-6">
<img class="img-fluid" src="https://i.pinimg.com/564x/2f/88/7a/2f887a63decbd91714c793a57d9360ba.jpg">
</div>
</div>
<div class="carousel-item">
<div class="col-lg-4 col-md-6">
<img class="img-fluid" src="https://i.pinimg.com/564x/fb/b7/36/fbb736a8ac8b2e38dfd00743e9df5580.jpg">
</div>
</div>
<div class="carousel-item">
<div class="col-lg-4 col-md-6">
<img class="img-fluid" src="https://i.pinimg.com/564x/7b/d5/51/7bd5513b739b30611141dda4021fe593.jpg">
</div>
</div>
<div class="carousel-item">
<div class="col-lg-4 col-md-6">
<img class="img-fluid" src="https://i.pinimg.com/564x/07/b1/12/07b1121262d4cff5f973ed63a10cf37b.jpg">
</div>
</div>
<div class="carousel-item">
<div class="col-lg-4 col-md-6">
<img class="img-fluid" src="https://i.pinimg.com/564x/10/70/c1/1070c10840ce05fe7f33757525a24027.jpg">
</div>
</div>
<div class="carousel-item">
<div class="col-lg-4 col-md-6">
<img class="img-fluid" src="https://i.pinimg.com/564x/78/0a/c6/780ac6e9e04640317a723b738d171375.jpg">
</div>
</div>
</div>
<a class="carousel-control-prev bg-dark w-auto left-arro" href="#myCarousel" 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 bg-dark w-auto right-arro" href="#myCarousel" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
</div>
2. Next, add some CSS Link to Images Slider:
<link href="https://www.jqueryscript.net/css/jquerysctipttop.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/4.3.1/darkly/bootstrap.min.css">
3. Next, add some CSS to Images Slider and position the container in the center:
/* medium - display 2 */
@media (min-width: 768px) {
.carousel-inner .carousel-item-right.active,
.carousel-inner .carousel-item-next {
transform: translateX(50%);
}
.carousel-inner .carousel-item-left.active,
.carousel-inner .carousel-item-prev {
transform: translateX(-50%);
}
}
/* large - display 3 */
@media (min-width: 992px) {
.carousel-inner .carousel-item-right.active,
.carousel-inner .carousel-item-next {
transform: translateX(33%);
}
.carousel-inner .carousel-item-left.active,
.carousel-inner .carousel-item-prev {
transform: translateX(-33%);
}
}
@media (max-width: 768px) {
.carousel-inner .carousel-item>div {
display: none;
}
.carousel-inner .carousel-item>div:first-child {
display: block;
}
}
.carousel-inner .carousel-item.active,
.carousel-inner .carousel-item-next,
.carousel-inner .carousel-item-prev {
display: flex;
}
.carousel-inner .carousel-item-right,
.carousel-inner .carousel-item-left {
transform: translateX(0);
}
.left-arro{
height: 4rem;
position: absolute;
left: -34px;
top: 13rem;
}
.right-arro{
right: -45px;
height: 4rem;
position: absolute;
top: 13rem;
}
.img-fluid {
max-width: 100%;
height: 31rem;
border-radius: 23px;
object-fit: cover;
}
.container {
margin: 42px auto;
}
3. Use JavaScript external link to Images Slider element inside the container:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
3. Use JavaScript to Images Slider element inside the container:
$('#myCarousel').carousel({
interval: 1000
})
$('.carousel .carousel-item').each(function() {
var minPerSlide = 4;
var next = $(this).next();
if (!next.length) {
next = $(this).siblings(':first');
}
next.children(':first-child').clone().appendTo($(this));
for (var i = 0; i < minPerSlide; i++) {
next = next.next();
if (!next.length) {
next = $(this).siblings(':first');
}
next.children(':first-child').clone().appendTo($(this));
}
});
* Hello buddy, I hope you are doing great and creating awesome projects. Today I have brought a useful project for you. In this project, you will learn to create Images Slider` using HTML CSS, and JavaScript. Yeah, HTML also provides us a select menu with the dropdown feature, but we will you will learn to make it more beautiful and fascinating.
Post a Comment