I am using this Caroufredsel plugin but it leaves me a blank space on the right every time it does a slide, and I would like one image to go right after the other.
This is my html, css and js code:
jQuery(document).ready(function() {
"use strict"
$('#slider-carousel').caroufredsel({
responsive: true,
width: '100%',
circular: true,
align: 'center',
scroll: {
items: 1,
pauseOnHover: true,
duration: 1000,
pauseOnHover: true,
timeoutDuration: 3000,
onBefore: function() {
$('ul#slider-carousel li')
.animate({
opacity: 0.5
}, 250);
},
onAfter: function() {
$('ul#slider-carousel li')
.filter(':eq(1)')
.animate({
opacity: 1
}, 250);
}
},
auto: true,
items: {
visible: {
min: 1,
max: 1,
},
start: -1,
height: "variable"
},
pagination: {
container: ".sliderpager",
anchorBuilder: false
}
});
});
/*slider*/
.container {
margin-left: 0;
margin-right: 0;
padding-left: 0;
padding-right: 0;
box-sizing: content-box;
height: 100%;
width: 100%;
}
.slider {
margin-top: 55px;
margin-left: 0;
margin-right: 0;
padding-left: 0;
padding-right: 0;
box-sizing: content-box;
height: 100%;
width: 100%;
}
.container .body-content {
margin-left: 0;
margin-right: 0;
padding-left: 0;
padding-right: 0;
box-sizing: content-box;
height: 100%;
width: 100%;
}
.slider ul.slider-carousel {
margin-left: 0;
margin-right: 0;
padding-left: 0;
padding-right: 0;
box-sizing: content-box;
height: 100%;
width: 100%;
}
.caroufredsel_wraper {
margin-left: 0;
margin-right: 0;
padding-left: 0;
padding-right: 0;
box-sizing: content-box;
height: 100%;
width: 100%;
}
.slider,
.slider ul.slider-carousel,
.slider ul.slider-carousel li {
height: 100%;
width: 100%;
text-align: center;
color: #FFF;
}
.slider ul.slider-carousel li h3 {
margin-top: 150px;
margin-bottom: 30px;
color: #FFF;
}
.slider ul.slider-carousel li p {
margin-bottom: 20px;
}
.img1 {
background: url('https://placehold.it/500x300/ff0000');
background-size: 100% 100%;
}
.img2 {
background: url('https://placehold.it/500x300/00ff00');
background-size: 100% 100%;
}
.img3 {
background: url('https://placehold.it/500x300/0000ff');
background-size: 100% 100%;
}
.slider ul.sliderpager li.selected a {
color: #E74C3C;
}
.slider ul.sliderpager li a {
color: #34495E;
}
.slider ul.sliderpager li {
padding: 0 3px;
height: 28px;
line-height: 28px;
display: inline-block;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.caroufredsel/6.2.1/jquery.carouFredSel.packed.js"></script>
<!-- slider -->
<div class="slider" id="slider">
<ul class="slider-carousel" id="slider-carousel">
<li class="img1">
<h3></h3>
<p></p>
</li>
<li class="img2">
<h3></h3>
<p></p>
</li>
<li class="img3">
<h3></h3>
<p></p>
</li>
</ul>
<ul class="sliderpager">
<li><a href="#"><i class="fa fa-circle"></i></a></li>
<li><a href="#"><i class="fa fa-circle"></i></a></li>
<li><a href="#"><i class="fa fa-circle"></i></a></li>
</ul>
</div>
The problem is that the carousel elements are
li
displayed as a block and that's why they don't allow an element in parallel with them. One possible solution would be to make themli
float. To do this, all you have to add to your CSS is this:And you will no longer see the white space between slides. Here you can see it working:
Looking through the documentation of the library
Caroufredsel
, I found an example that could help you and that avoids blank spaces, I followed the steps of the example and tried to adapt it to your specification, I hope it helps youThe above code does the sliders but with div not with list , but it might be an interesting idea and it would solve your problem.