splide icon indicating copy to clipboard operation
splide copied to clipboard

Items gap not working

Open kostas33 opened this issue 5 years ago • 4 comments

Hi there, am i the only one here who cannot get the gap parameter to work?? *** i love the slider btw, nice work guys

kostas33 avatar Dec 20 '20 16:12 kostas33

I've been able to use the gap with no problems. What is the specific issue you're experiencing?

johnson-jd avatar Dec 22 '20 23:12 johnson-jd

Even at the simple carousel (not grid) i am not able to give it the gap i want. Even without any gap parameter, i get all the items side by side with NO gap... I have inserted the css file even though this is not a CSS issue.

kostas33 avatar Dec 23 '20 16:12 kostas33

I have the same problem.

  • Either images are aligned closely side by side
  • Either random gap appears, but then last slide hides behind slider tail

Splidejs version: 2.4.20

Here is an example. Play with perPage and gap values - set perPage to 4 or 6 and You will see difference.

https://codepen.io/arnisjuraga/pen/GRmwgeE

new Splide("#image-slider-nobootstrap", {            
            //perPage: 6,   // 6 slides does not have gap!
            perPage: 4,   // 4 slides has gap, but last slide is hidden behind the tail of slider...
            gap: "5rem",
            
            classes: {
                // Add classes for arrows.
                prev: 'splide__arrow--prev splide-self-prev',
                next: 'splide__arrow--next splide-self-next',
            }
        }).mount();
<div id="image-slider-nobootstrap" class="splide" style="width: 800px;">
  <div class="splide__track">
    <ul class="splide__list">			      
        <li class="splide__slide"><img src="https://picsum.photos/id/237/200/300"></li>
        <li class="splide__slide"><img src="https://picsum.photos/id/238/200/300"></li>
        <li class="splide__slide"><img src="https://picsum.photos/id/239/200/300"></li>      
        <li class="splide__slide"><img src="https://picsum.photos/id/239/200/300"></li>
        <li class="splide__slide"><img src="https://picsum.photos/id/1/200/300"></li>
        <li class="splide__slide"><img src="https://picsum.photos/id/2/200/300"></li>
        <li class="splide__slide"><img src="https://picsum.photos/id/3/200/300"></li>      
    </ul>
  </div>

arnisjuraga avatar Aug 07 '21 12:08 arnisjuraga

Close the issue due to the major version update. Feel free to create a new issue or open a new discussion.


That is because of style="width: 800px;. Remove it and use the width option.

NaotoshiFujita avatar Oct 09 '21 14:10 NaotoshiFujita