Я создал макет динамического c, который извлекает изображение из моей таблицы banner
и отображается на странице просмотра. Я уже настроил модель и контроллер в своем проекте laravel. Это выглядит примерно так:
Получает 2 изображения, но укладывает их один под другим. Я хотел бы знать, есть ли способ сделать его в виде слайдера, то есть 1-й рисунок будет перемещаться влево / вправо и автоматически изменится на 2-й, и т. Д. И т. Д.
Мой код:
<!-- Banner Area Start -->
<section class="hero-area">
<div class="hero-area-slider">
<!--class for display banner -->
<div class="intro-carousel">
@foreach($data as $pic)
<div class="intro-content" style="background-image: url({{asset('/images/'.$pic->photo)}})">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="slider-content">
</div>
</div>
</div>
</div>
</div>
@endforeach
</div>
</section>
<br>
Стиль:
/*-----------------------------
** Banner Area Start
------------------------------*/
.hero-area .hero-area-slider .intro-carousel .intro-content {
background-size: cover;
height: 500px;
display: flex;
align-items: center;
background-position: center !important;
background-size: cover !important;
background-repeat: no-repeat !important;
margin-top: 10px;
margin-left: 80px;
margin-right: 80px;
}
.hero-area .hero-area-slider .intro-carousel .intro-content.slide-one {
text-align: left; }
.hero-area .hero-area-slider .intro-carousel .intro-content.slide-two {
text-align: center; }
.hero-area .hero-area-slider .intro-carousel .intro-content.slide-three {
text-align: right; }
.hero-area .hero-area-slider .intro-carousel .intro-content .slider-content .layer-1 .subtitle {
font-size: 24px;
font-weight: 700;
color: #143250;
}
.hero-area .hero-area-slider .intro-carousel .intro-content .slider-content .layer-1 .title {
font-size: 36px;
font-weight: 700;
color: #ff5500;
}
.hero-area .hero-area-slider .intro-carousel .intro-content .slider-content .layer-2 .text {
font-size: 16px;
font-weight: 600;
color: #143250;
max-width: 400px;
display: inline-block; }
.hero-area .hero-area-slider .intro-carousel .intro-content .slider-content .layer-3 a {
margin-top: 15px;
text-align: center;
border: 1px solid #ff5500;
}
.hero-area .hero-area-slider .intro-carousel .intro-content .slider-content .layer-3 a:hover {
background: #fff;
color: #ff5500;
}
.hero-area .hero-area-slider .intro-carousel .intro-content .slider-content .layer-3 a i{
font-size: 13px;}
/* hero Slider dot design Start */
.hero-area .hero-area-slider .owl-controls .owl-dots {
display: block;
position: absolute;
text-align: center;
margin-top: 0px;
left: 50%;
transform: translateX(-50%);
bottom: 20px;
}
.hero-area .hero-area-slider .owl-controls .owl-dots .owl-dot {
width: 25px;
height: 6px;
background: #fff;
display: inline-block;
border-radius: 0px;
transform: skewX(-30deg);
margin: 0px 3px 0px;
-webkit-transition: 0.3s ease-in;
-moz-transition: 0.3s ease-in;
-o-transition: 0.3s ease-in;
transition: 0.3s ease-in;
box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.1);
}
.hero-area .hero-area-slider .owl-controls .owl-dots .owl-dot.active {
background: #fff;
width: 50px
}
.blog-area .aside .slider-wrapper .owl-controls .owl-dots {
display: block;
text-align: center;
margin-top: -1px; }
.blog-area .aside .slider-wrapper .owl-controls .owl-dots .owl-dot {
width: 10px;
height: 10px;
background: #c2c2c2;
display: inline-block;
border-radius: 50%;
margin: 0px 3px 0px;
-webkit-transition: 0.3s ease-in;
-moz-transition: 0.3s ease-in;
-o-transition: 0.3s ease-in;
transition: 0.3s ease-in; }
.blog-area .aside .slider-wrapper .owl-controls .owl-dots .owl-dot.active {
background: #ff5500;
-webkit-transform: scale(1.2);
-ms-transform: scale(1.2);
transform: scale(1.2); }
Интересно, могу ли я добавить ползунок, где я также могу использовать свою мышь и кликать / перетаскивать влево или вправо, чтобы изменить изображение. Спасибо