So im currently building a website and im having an issue with OWL Carousel, it seems like the images are stacking above eachother when changing image on the slider, resulting in a huge blank space.
Error can be seen here : www.hissey-data.co.uk
Any help would be greatly appreciated. Thanks.
I have provided the code below.
OWL Carousel Code
$(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;
}
I think in your project you may forget to add these 2 things.
<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">
Try to add this. you can see running example below.
$(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>