metafizzy / flickity

:leaves: Touch, responsive, flickable carousels
https://flickity.metafizzy.co
7.52k stars 605 forks source link

Drag the full length of slider with 1 click #833

Closed lincolnlemos closed 5 years ago

lincolnlemos commented 6 years ago

It's possible to control how many pixels the slider will move if I drag it? I want to make 100% progress of slider in just one click.

desandro commented 6 years ago

I feel like I'm missing some information here. I imagine you're using freeScroll and a trying to use Flickity as a kind of horizontal scroller with a single cell? If so, then no.

The way to align content in Flickity is with multiple cells and selecting those cells.

lincolnlemos commented 6 years ago

Sorry @desandro, maybe I didn't express me correctly.

I made this pen to explain me better. https://codepen.io/lincolnlemos/pen/EeQeRo

What I want: When I start dragging the slider, I want to move the sliders from 13 to 25 (or 13 to 0) with just one drag.

What I have in mind: Get the clientX position on dragStar Make a proportion with the clientX position between the difference from the viewport edges and the length of the slider _ Use this proportion to calculate how much pixels will move for each pixel that I drag

desandro commented 6 years ago

Thanks for that. You could group cells together in parent elements and use those parent elements for cells. Or you can try using groupCells