Slick slider wrong width on initialization
Asked Answered
C

1

0

I am trying to implement Slick slider, but calculated width of each slide is wrong (padding on right side of image).

<div class="responsive-slick">
    <img src="Gallery/large/01.jpeg">
    <img src="Gallery/large/02.jpeg">
    <img src="Gallery/large/03.jpeg">
    <img src="Gallery/large/04.jpeg">
    <img src="Gallery/large/05.jpeg">
    <img src="Gallery/large/06.jpeg">
</div>

$(document).ready(function(){
   $('.responsive-slick').slick({
       dots: true,
       mobileFirst:true,
       prevArrow: '<a class="slick-prev">Previous</button>',
       nextArrow: '<a class="slick-prev">Previous</button>',
       slidesToShow: 3,
       slidesToScroll: 8
   });

});

Output: enter image description here

What am I doing wrong?

Convenience answered 8/7, 2017 at 18:47 Comment(2)
do you have any css for images or div?Aerothermodynamics
no other javascript, no css. I only included jquery, bootstrap and slick.Convenience
R
0

Your current code is having problem

$('.responsive-slick').slick({
   dots: true,
   mobileFirst:true,
   **prevArrow: '<a class="slick-prev">Previous</button>',
   nextArrow: '<a class="slick-prev">Previous</button>',**
   slidesToShow: 3,
   slidesToScroll: 8
});

You are opening an anchor tag and closing a button. Thats wrong.

Ridgepole answered 8/7, 2017 at 19:3 Comment(2)
You are right, it was an error, but problem remainsConvenience
I tried to change jquery.min.js from 3.2.1 to 2.2.4 and it worked. Strange. Anyway, thanks. I'll accept your answer.Convenience

© 2022 - 2024 — McMap. All rights reserved.