Issue
The problem is that the slick slider div has overflow: hidden; so the box-shadows of the slides divs keep getting cut off.
Anybody ran into this problem too?
Here is a little fiddle demonstrating the problem: https://jsfiddle.net/2zvcud0u/
HTML
<div class="slider row">
<div class="col-sm-4">
<div class="drop-shadow">
<div class="content">
<p>Lorem ipsum dolor sit amet</p>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="drop-shadow">
<div class="content">
<p>Lorem ipsum dolor sit amet</p>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="drop-shadow">
<div class="content">
<p>Lorem ipsum dolor sit amet</p>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="drop-shadow">
<div class="content">
<p>Lorem ipsum dolor sit amet</p>
</div>
</div>
</div>
</div>
</div>
CSS
.row{
margin: 20px 0;
}
.drop-shadow {
box-shadow: 0px 0px 43px 0px rgba(0, 0, 0, 0.35);
}
.content{
margin: 10px;
}
JS
$('.slider').slick({
autoplay: false,
dots: false,
arrows: false,
infinite: false,
speed: 300,
slidesToShow: 3,
slidesToScroll: 1,
swipeToSlide: true,
responsive: [{
breakpoint: 992,
settings: {
slidesToShow: 2
}
}, {
breakpoint: 768,
settings: {
slidesToShow: 1
}
}]
});
Thanks for any suggestions
Solution
Alright folks, i think i found a quiet easy solution.
We put a wrapper div around the slider with following CSS:
.slider-wrapper {
width: calc(100% + 30px); //we need more width for the shadows on the edges
padding: 0 15px; //space for the shadows
margin-left: -15px; //put the div in its original position
overflow: hidden; //hide the overflow
}
We make the slick-list div overflow visible:
.slick-list {
overflow: visible;
}
Thats it for the first part.
Another problem is that the box-shadow of the first element in the overflow is still visible.
This should fix it:
.slick-slide .drop-shadow {
box-shadow: none; //no shadow for a hidden slide
transition: box-shadow 0.1s ease-in-out; //little effect to fade the shadow
}
.slick-slide.slick-active .drop-shadow {
box-shadow: 0px 0px 43px 0px rgba(0, 0, 0, 0.35); //only the active slides have the shadow
}
Here's another demo fiddle: https://jsfiddle.net/cc5fmwaL/2/
I hope i could help someone out and feel free to revise this quick solution.
Answered By - JJaun
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.