OWL 轮播堆叠图片
OWL carousel stacking images
所以我目前正在构建一个网站,但我遇到了 OWL 旋转木马的问题,当在滑块上更改图像时,图像似乎堆叠在彼此之上,导致巨大的空白 space .
这里可以看到错误:www.hissey-data.co.uk
如有任何帮助,我们将不胜感激。谢谢。
我提供了下面的代码。
OWL 轮播代码
$(document).ready(function() {
$("#owl-banner").owlCarousel({
nav : true, // Show next and prev buttons
slideSpeed : 300,
paginationSpeed : 400,
items: 1,
singleItem: true,
dots:false,
});
});
HTML
<div class="owlWrapper">
<div id="owl-banner" class="owl-carousel owl-theme">
<div class="item"><img src="images/Banner.png" alt="slider 1"></div>
<div class="item"><img src="images/Banner.png" alt="slider 2"></div>
<div class="item"><img src="images/Banner.png" alt="slider 3"></div>
</div>
</div>
.owlWrapper{
margin:0 auto;
width: 100%;
height: auto;
overflow: hidden;
}
#owl-banner .item img{
text-align: center;
display: block;
width: 100%;
height: auto;
font-family: 'Lato', sans-serif;
}
.owl-item.active .caption {
transform: translate(0,-50%);
}
.owl-nav {
position: absolute;
bottom: 45%;
left: 0;
margin: 0;
width: 100%;
display: flex;
justify-content: space-between;
}
.owl-nav button {
background-color: rgb(179, 20, 2) !important;
border-radius: 0% !important;
width: 80px;
height: 50px;
display: inline-block;
text-align: center;
line-height: 50px !important;
outline: none;
transition: all 300ms ease;
}
.owl-nav button.owl-next {
margin-left: 0;
margin-right: 100%;
}
.owl-nav button span {
font-size: 2em;
color: white;
display: block;
}
.owl-nav button:hover {
background: rgb(86, 13, 5) !important;
}
我认为在您的项目中您可能忘记添加这两个东西。
<script src="https://cdnjs.cloudflare.com/ajax/libs/owl-carousel/1.3.3/owl.carousel.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/owl-carousel/1.3.3/owl.carousel.min.css" rel="stylesheet">
尝试添加这个。您可以在下面查看 运行 示例。
$(document).ready(function() {
$("#owl-banner").owlCarousel({
nav: true, // Show next and prev buttons
slideSpeed: 300,
paginationSpeed: 400,
items: 1,
singleItem: true,
dots: false,
});
});
.owlWrapper {
margin: 0 auto;
width: 100%;
height: auto;
overflow: hidden;
}
#owl-banner .item img {
text-align: center;
display: block;
width: 100%;
height: auto;
font-family: 'Lato', sans-serif;
}
.owl-item.active .caption {
transform: translate(0, -50%);
}
.owl-nav {
position: absolute;
bottom: 45%;
left: 0;
margin: 0;
width: 100%;
display: flex;
justify-content: space-between;
}
.owl-nav button {
background-color: rgb(179, 20, 2) !important;
border-radius: 0% !important;
width: 80px;
height: 50px;
display: inline-block;
text-align: center;
line-height: 50px !important;
outline: none;
transition: all 300ms ease;
}
.owl-nav button.owl-next {
margin-left: 0;
margin-right: 100%;
}
.owl-nav button span {
font-size: 2em;
color: white;
display: block;
}
.owl-nav button:hover {
background: rgb(86, 13, 5) !important;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/owl-carousel/1.3.3/owl.carousel.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/owl-carousel/1.3.3/owl.carousel.min.css" rel="stylesheet">
<div class="owlWrapper">
<div id="owl-banner" class="owl-carousel owl-theme">
<div class="item"><img src="http://via.placeholder.com/750x450.png?text=slider1" alt="slider 1"></div>
<div class="item"><img src="http://via.placeholder.com/750x450.png?text=slider2" alt="slider 2"></div>
<div class="item"><img src="http://via.placeholder.com/750x450.png?text=slider3" alt="slider 3"></div>
</div>
</div>
所以我目前正在构建一个网站,但我遇到了 OWL 旋转木马的问题,当在滑块上更改图像时,图像似乎堆叠在彼此之上,导致巨大的空白 space .
这里可以看到错误:www.hissey-data.co.uk
如有任何帮助,我们将不胜感激。谢谢。
我提供了下面的代码。
OWL 轮播代码
$(document).ready(function() {
$("#owl-banner").owlCarousel({
nav : true, // Show next and prev buttons
slideSpeed : 300,
paginationSpeed : 400,
items: 1,
singleItem: true,
dots:false,
});
});
HTML
<div class="owlWrapper">
<div id="owl-banner" class="owl-carousel owl-theme">
<div class="item"><img src="images/Banner.png" alt="slider 1"></div>
<div class="item"><img src="images/Banner.png" alt="slider 2"></div>
<div class="item"><img src="images/Banner.png" alt="slider 3"></div>
</div>
</div>
.owlWrapper{
margin:0 auto;
width: 100%;
height: auto;
overflow: hidden;
}
#owl-banner .item img{
text-align: center;
display: block;
width: 100%;
height: auto;
font-family: 'Lato', sans-serif;
}
.owl-item.active .caption {
transform: translate(0,-50%);
}
.owl-nav {
position: absolute;
bottom: 45%;
left: 0;
margin: 0;
width: 100%;
display: flex;
justify-content: space-between;
}
.owl-nav button {
background-color: rgb(179, 20, 2) !important;
border-radius: 0% !important;
width: 80px;
height: 50px;
display: inline-block;
text-align: center;
line-height: 50px !important;
outline: none;
transition: all 300ms ease;
}
.owl-nav button.owl-next {
margin-left: 0;
margin-right: 100%;
}
.owl-nav button span {
font-size: 2em;
color: white;
display: block;
}
.owl-nav button:hover {
background: rgb(86, 13, 5) !important;
}
我认为在您的项目中您可能忘记添加这两个东西。
<script src="https://cdnjs.cloudflare.com/ajax/libs/owl-carousel/1.3.3/owl.carousel.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/owl-carousel/1.3.3/owl.carousel.min.css" rel="stylesheet">
尝试添加这个。您可以在下面查看 运行 示例。
$(document).ready(function() {
$("#owl-banner").owlCarousel({
nav: true, // Show next and prev buttons
slideSpeed: 300,
paginationSpeed: 400,
items: 1,
singleItem: true,
dots: false,
});
});
.owlWrapper {
margin: 0 auto;
width: 100%;
height: auto;
overflow: hidden;
}
#owl-banner .item img {
text-align: center;
display: block;
width: 100%;
height: auto;
font-family: 'Lato', sans-serif;
}
.owl-item.active .caption {
transform: translate(0, -50%);
}
.owl-nav {
position: absolute;
bottom: 45%;
left: 0;
margin: 0;
width: 100%;
display: flex;
justify-content: space-between;
}
.owl-nav button {
background-color: rgb(179, 20, 2) !important;
border-radius: 0% !important;
width: 80px;
height: 50px;
display: inline-block;
text-align: center;
line-height: 50px !important;
outline: none;
transition: all 300ms ease;
}
.owl-nav button.owl-next {
margin-left: 0;
margin-right: 100%;
}
.owl-nav button span {
font-size: 2em;
color: white;
display: block;
}
.owl-nav button:hover {
background: rgb(86, 13, 5) !important;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/owl-carousel/1.3.3/owl.carousel.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/owl-carousel/1.3.3/owl.carousel.min.css" rel="stylesheet">
<div class="owlWrapper">
<div id="owl-banner" class="owl-carousel owl-theme">
<div class="item"><img src="http://via.placeholder.com/750x450.png?text=slider1" alt="slider 1"></div>
<div class="item"><img src="http://via.placeholder.com/750x450.png?text=slider2" alt="slider 2"></div>
<div class="item"><img src="http://via.placeholder.com/750x450.png?text=slider3" alt="slider 3"></div>
</div>
</div>