keen-slider icon indicating copy to clipboard operation
keen-slider copied to clipboard

Feature Request: Group Slide

Open AndrewBogdanovTSS opened this issue 3 years ago • 11 comments

Although currently there is a way to display multiple slides per view I wasn't able to find any built it way to make it work properly with controls. Provided controls example only account for one slide per view, but what I would like to do is to slide per view when user clicks on the arrow or dot. Amount of dots should also represent the amount of views, not slides.

AndrewBogdanovTSS avatar Sep 21 '20 17:09 AndrewBogdanovTSS

Hello @AndrewBogdanovTSS

you can make this work with a few changes. See here: https://codesandbox.io/s/keen-slider-navigation-vue-forked-qd9l6?file=/src/Slider.vue

But it's not a 100% solution. I will provide a built-in possibility in the next version.

rcbyr avatar Sep 22 '20 09:09 rcbyr

Solution you provided has issues:

  1. It's not scrolling per screen which is more preferable with such setup
  2. It has issues with different number of slides, for example if number per view is equal to 3 in your example - dots are not highlighted correctly when clicking: https://codesandbox.io/s/keen-slider-navigation-vue-forked-ewbdf

AndrewBogdanovTSS avatar Sep 22 '20 11:09 AndrewBogdanovTSS

In case inspiration is needed - here you can see how that feature can look like: http://ganlanyuan.github.io/tiny-slider/demo/#base_wrapper

AndrewBogdanovTSS avatar Sep 22 '20 11:09 AndrewBogdanovTSS

Is there an update for this case? I need dots for a slider with slidesPerView > 1 AND breakpoints that change the slidesPerView Option... :-/

phoebusryan avatar Oct 21 '21 09:10 phoebusryan

Would love to see this. Has anyone got a way to do it now?

jordie23 avatar Nov 22 '21 04:11 jordie23

Actually, I think this might be a solution? https://github.com/rcbyr/keen-slider/issues/130

jordie23 avatar Nov 22 '21 04:11 jordie23

Currently .details() no longer available. Also, this feature is needed when using perView: "auto" It is difficult to calculate the number of sliders on the current page.

For example: https://codesandbox.io/s/summer-rgb-wnhxmv?file=/src/App.tsx

.keen-slider__slide {
  min-width: 250px; // 3 sliders
}

@media (min-width: 1000px) {
  .keen-slider__slide {
    min-width: 150px; // 5 sliders
   }
}

Maybe we need an option to set a number of slides going on one "click"

perMove: number | 'auto' 

perMove: 'auto' automatically calculates the number of sliders.

nghiepdev avatar May 24 '22 11:05 nghiepdev

I'm not really sure about some of these outdated answers, but the following works for me (works with breakpoints):

arrowLeft.addEventListener("click", function () {
  slider.moveToIdx(
    slider.track.details.rel - slider.options.slides.perView
  );
});
arrowRight.addEventListener("click", function () {
  slider.moveToIdx(
    slider.track.details.rel + slider.options.slides.perView
  );
});

ToshY avatar Jul 10 '22 11:07 ToshY

Any updates on this feature?

chz avatar Dec 28 '22 09:12 chz

I've solved this problem in my case:

<Arrow
          onClick={e => {
            const slider = instanceRef.current;
            e.stopPropagation() ||
              slider?.moveToIdx(
                slider?.track.details.abs +
                  Math.floor(slider?.size / 168) -
                  (isMobile ? 0 : 1),
                true,
                { duration: 1500 },
              );
          }}
        />

GephestUA avatar Dec 29 '22 14:12 GephestUA

Any Feature for Group Slide When Scrolling?

5earle avatar Jun 28 '23 16:06 5earle