flickity icon indicating copy to clipboard operation
flickity copied to clipboard

Add class to cell closest to selected alignment at any time

Open FreshDoc opened this issue 11 years ago • 7 comments

Slide doesn't selected during swype. It selected after swype. If I do swype I can't see which slide will be selected when I detach a finger from a touch screen.

FreshDoc avatar Feb 16 '15 12:02 FreshDoc

Could you provide a reduced test case? See Submitting Issues in the contributing guidelines.

desandro avatar Feb 16 '15 12:02 desandro

Built a reduced test case here to replicate this issue. It is the case. The is-selected class doesn't move to the relevant cell until after the finger is lifted off the screen. I'm guessing due to being linked to touchend?

dom-turnbull avatar Feb 17 '15 12:02 dom-turnbull

@madebydominick thanks for the CodePen

This cell selection behavior is by design. A selected cell is not the one closest to the selected alignment, it is the one that will end up at the selected alignment. This allows users to flick past a cell, or move forward, then back to a previous cell. There's no way to know what cell will be selected until after the drag (or swipe) has ended.

It sounds like what you're looking for is an additional selected class, that selects the cell closest to the selected alignment at any time. If others would like to see this feature added, please +1 this issue.

desandro avatar Feb 17 '15 13:02 desandro

@wgstjf This sounds like a separate issue. I've deleted your comment here and moved discussion to #69

desandro avatar Mar 03 '15 22:03 desandro

I do need this feature too, having the .is-selected element changing during swiping.

MeMyselfI avatar Jun 09 '15 16:06 MeMyselfI

See my solution for adding is-previous and is-next classes to the previous and next cells: https://github.com/metafizzy/flickity/pull/227#issuecomment-135107460

Closing this issue here. Keep discussion to 227

desandro avatar Aug 31 '15 15:08 desandro

I'm sorry, I don't see how these two issues are related to each other. What we asked for is a .selected class for the item that will probably be selected (so the one that's in the middle) DURING SWIPING. The .is-previous and .is-next are set AFTER THE SWIPING. That doesn't help.

MeMyselfI avatar Aug 31 '15 16:08 MeMyselfI