kenwheeler / slick

the last carousel you'll ever need
kenwheeler.github.io/slick
MIT License
28.54k stars 5.89k forks source link

Showing the last item half off the screen #973

Closed sekoyo closed 9 years ago

sekoyo commented 9 years ago

Hi I have a multiple carousel which has no arrows or dots and I would like to indicate there are more items by showing an item half hidden on the right side. Do you have any suggestions for doing this? Thanks

kenwheeler commented 9 years ago

Center mode does this pretty well

sekoyo commented 9 years ago

Thanks will check that out

sekoyo commented 9 years ago

In case anyone comes across this, center wasn't right for me so this is what I did:

// options
onSetPosition: this.onSetPosition

// a method/func
onSetPosition: function() {
    if (this.$slides.length > this.options.slidesToShow) {
        // Note: don't use this.slideWidth for this.
        var slideWidth = this.$slides.first().width();
        var addValueToEach = (slideWidth / 2) / this.options.slidesToShow;
        this.$slides.width(slideWidth + addValueToEach);
    }
}
jondotblack commented 9 years ago

@DominicTobias I'm looking to produce the same effect, but I assume your solution would only work if you have an infinite scroll. Otherwise won't the last item always be cut off?

sekoyo commented 9 years ago

@blackatlmbrjck I'm not sure actually, shortly after the client decided to have carousel arrows so I removed this. I don't remember it being broken but not sure!

CarlFredrik commented 8 years ago

Late answer, but this is easily achievable by writing something similar to this in the slider settings: slidesToShow: 3.3,

nikola-wd commented 7 years ago

@CarlFredrik This centers it, same effect as if u used centerMode: true.... How to make only next item slightly show

harryjoao commented 7 years ago

@CarlFredrik THANK YOU !!!!!!!!!!

vagnerolliver commented 6 years ago

@CarlFredrik PERFECT!!!!!! tks

kenold commented 6 years ago

Both solutions work OK, but is there a way to not cut the first slide? It's cutting off both first and last slides.

[UPDATE] I set infinite: false and it worked :-)

alexlamazing commented 5 years ago

Both solutions work OK, but is there a way to not cut the first slide? It's cutting off both first and last slides.

[UPDATE] I set infinite: false and it worked :-)

Thanks @kenold . What should I do if I need infinite to be true?

aronmoshe-m commented 4 years ago

This thread saved me so much time; thank you!

turbowars commented 3 years ago

Both solutions work OK, but is there a way to not cut the first slide? It's cutting off both first and last slides. [UPDATE] I set infinite: false and it worked :-)

Thanks @kenold . What should I do if I need infinite to be true?

did you find a solution? I am looking for this.

lakshbhutani commented 2 years ago

Finally, this solution helped me https://stackoverflow.com/questions/60440138/centering-slides-with-react-slick

chadjaa-sofiane commented 2 years ago

I had the same issue when the last item doesn't appear and the slider stops at the center of the screen before the last item be visible. the solution that I found is to insert fake divs inside your slider.

<Slider ....>
    {/* your isintial divs here */} 
   <div/> 
   <div/>
</Slider>
vipinwap07 commented 1 year ago

I think there is no rock-solid solution for this issue, but I found a trick.

Inserting an empty div at the end of all items worked for me.

Hope this is helpful.