react-slick icon indicating copy to clipboard operation
react-slick copied to clipboard

Finite variable width slider (that scrolls only visible slides), slides should always fill the display area

Open dryleaf opened this issue 6 years ago • 17 comments

I hope this is not a "big ask" but I'm stuck and I love your library as it has helped me a lot in the past.

Overview

My issue is that I'm trying to adjust the variable width slider (in your documentation) in order to be:

  1. finite
  2. responsive (to different viewports) (if possible to display as many slides according to viewport width)
  3. scroll only 100% visible slides
  4. slides should fill the div display area

Observations

  1. So far, I have managed to make it:

    • finite
  2. Regarding responsive, breakpoints don't work well for variable width slides.

  3. scroll only 100% visible slides, This is very important when it comes to variable viewport width and when using variable width slides.

  4. slides should fill thedivdisplay area, finite variable width slides when they reach the last slide, even though it was already visible by the previous scroll, the user can still scroll and what is visible is a huge area of blank slides, for example: blank slides visible after last slide

The Code

The issue can be replicated and tested in code sandbox

I'm open to hear your expert solutions.

dryleaf avatar Aug 08 '18 23:08 dryleaf

I've made a fix that would allow the finite variable width slider sliders to always fill the display area, using a new setting. I've added the pull request, not sure if it will be handled soon. In any case, you are free to use my own fork in your package.json: "react-slick": "git+https://[email protected]/diegopamio/react-slick.git",

But ideally, if you can, also please vote so that the pull request gets attention.

diegopamio avatar Aug 13 '18 13:08 diegopamio

Thanks. Is there a way I can use your solution in Code Sandbox?

dryleaf avatar Aug 13 '18 13:08 dryleaf

According to https://github.com/CompuIves/codesandbox-client/issues/278 you can do that by manually updating the package.json with: "react-slick": "diegopamio/react-slick.git"

instead of the full uri. I've tried that and it worked for me.

diegopamio avatar Aug 13 '18 13:08 diegopamio

It forces 1 slide scroll at a time. You can view here code Sandbox

dryleaf avatar Aug 13 '18 14:08 dryleaf

Yes, it does, but know I'm thinking perhaps that's not needed, as it should work even when slidesToScroll > 1... I can modify that guard.

diegopamio avatar Aug 13 '18 15:08 diegopamio

My ideal scroller would be the one that is:

  • finite
  • Variable width
  • scrolls all 100% visible slides at a time (irrespective of viewports or screen width)
  • with no paddings or centerings

dryleaf avatar Aug 15 '18 22:08 dryleaf

Done, I've updated the PR to do that.

diegopamio avatar Aug 21 '18 20:08 diegopamio

I have tested and it doesn't work. And the following test case: fails

  • Scrolls all 100% visible slides at a time (irrespective of viewports or screen width)

This means that if 3 slides are 100% visible, then they should all be scrolled, and so on. But your solution always scrolls one slide at time and it can not be changed.

I suggested you test it first with the following code:

dryleaf avatar Aug 22 '18 00:08 dryleaf

@diegopamio any suggestion for this problem solving? variableWidth: true infinite: false, lead to blank space from the right.

I've just expecting last slide right border to intersect slider right border + partially view left slide. But in last right position 've full size left slide + blank space from the right.

akimy avatar Jun 10 '19 18:06 akimy

any fixes for spaces on from right?

leadq avatar May 22 '20 14:05 leadq

@akiran 👋 is there any update on this issue? I can still reproduce this issue.

leimonio avatar Sep 16 '20 14:09 leimonio

i'm looking for a fix to this as well. any updates?

babysteps avatar Sep 26 '20 19:09 babysteps

@diegopamio any suggestion for this problem solving? variableWidth: true infinite: false, lead to blank space from the right.

I've just expecting last slide right border to intersect slider right border + partially view left slide. But in last right position 've full size left slide + blank space from the right.

I encountered this problem as well.

jota12x avatar Sep 27 '21 07:09 jota12x

Me too.

taigfs avatar Jul 01 '22 14:07 taigfs

Same here +1

p-abasian avatar Oct 27 '22 13:10 p-abasian

+1

duongthaison98 avatar Mar 03 '23 08:03 duongthaison98

@akiran w.r.t. to above scenario, when variableWidth is true and infinite is false, the below issue also occurs

Situation:

  • When variableWidth is true
  • Arrows are shown (I need to show the arrows as the content is dynamic and it can overflow the viewport)

Issue:

  • Arrows should be disabled or should not show when all the elements are visible in viewport

Similar issue was found in swiper js, but they have the provision of watching the overflow by a watchOverflow prop which is set to true, which take care of the above issue mentioned.

dikshantpatodia avatar Aug 04 '23 08:08 dikshantpatodia