-
-
Notifications
You must be signed in to change notification settings - Fork 778
How can i make 2 or more slides move when i click the prev or next controls #346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Same here. Is it possible? |
I have bumped into a similar issue. I would like to make 3 slide leap while autoplay is set on true. Here is an example: https://codepen.io/szympol/pen/ZZwVjx It is now possible to make a desirable move by clicking one of the dots thanks to Is there any way to change the glider's number of moves? |
don't think this is the cleanest solution, and I still didn't implement it to work with different values for different breakpoints, but this seems to work for me: const step = 2
slider.on('run.before', (evt) => {
evt.steps = evt.direction === '>' ? -step : step
}) |
@lucari94 This works well but it would be cool to have the step following the responsive settings, so we could have scrolling by the number of items displayed at each moment. |
I managed to do what I wanted like this: this.carousel.on('run.before', evt => {
const scrollSteps = this.carousel.settings.perView;
evt.steps = evt.direction === '>' ? -scrollSteps : scrollSteps;
}); It manages the changes of breakpoint automatically, if you have set different perView values per breakpoints. |
I fixed this by setting:
in calculate on line 981 of glide.js. |
You can use pipe <div class="glide">
<div data-glide-el="controls">
<button data-glide-dir="|<">prev</button>
<button data-glide-dir="|>">next</button>
</div>
</div> const glide = new Glide('.glide', {
type: 'carousel',
perView: 3,
perSwipe: '|',
}).mount(); Codepen: https://codepen.io/vadkart/pen/VwYROJr |
I'm running v3.4.1 but get an error code when I tried implementing your example. When using your code, which does work in the codepen, I get the following error:
I'm uncertain what could be causing this issue, as I copied your code just to make sure it wasn't something I did incorrectly, but I still get that error. Thanks in advance for any guidance. |
Unfortunately, it doesn't work anymore in v3.4.1. |
If someone does not want bullets to be affected from this, use this:
|
It works on 3.5.2, to move perView: <div data-glide-el="controls">
<button data-glide-dir="|<">Start</button>
<button data-glide-dir="|>">End</button>
</div> |
This is to answer a little bit this [issue](glidejs/glide#346)
But what about pattern when
PS: second bullet is inactive and we slide to the third :( |
Great to see this was implemented as one of my projects was using a hacky solution for this 🎉 I didn't know it was possible with newer versions. @jedrzejchalubek Could you add the pagination value ( |
There is already a pr from one year ago to approve ;) |
Doesn't work properly if perView is a decimal such as 3.5 |
Schema value of the data-glide-dir attribute must be in special format:
Coped from the offical docs at controls section: |
How can i make 2 or more slides move when i click the prev or next controls buttons?
Currently the previous and next buttons only move one slide at a time.
The text was updated successfully, but these errors were encountered: