Skip to content
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

initialIndex and groupCells #818

Closed
runnickrun opened this issue Aug 22, 2018 · 6 comments
Closed

initialIndex and groupCells #818

runnickrun opened this issue Aug 22, 2018 · 6 comments

Comments

@runnickrun
Copy link

I'm trying to set initialIndex on a carousel where I use groupCells but apparently nothing happens.
Any workaround to achieve the functionality?

Test case: https://codepen.io/runnick/pen/GXgbXr

@AdamJaggard
Copy link

Because the cells are grouped initial index is now counting groups not cells, so there is no index 7 any more because there are only 4 groups. If you want the 7th cell then you can set initial index to 2 (to get the 3rd group). You could figure it our programatically if you know how many cells are in each group. No idea if this is intended behaviour or not.

@runnickrun
Copy link
Author

@AdamJaggard thanks, in my requirement though it should show as first slide (not just on the screen).
So I was wondering maybe it's possible not to use groupCells but still retain the ability to move carousel by 3, 4, n slides per change.

@desandro
Copy link
Member

@runnickrun If you want to select a group slide by cell index or cell selector string, you can do so with selectCell method

@runnickrun
Copy link
Author

@desandro Yeah, I tried that, but that still select group, so e.g. if item is 3rd in the group, it will be 3rd on the screen. What I'm trying to achieve is to show the selected item as first.

Example of this could be seen here:
https://www.dailymotion.com/video/x6s3cjm?playlist=x5z978

image

upon clicking on the previous arrow, remaining slides are shown

image

Hopefully that makes sense. I assume it means to kind of “split” the group and understand that it might not be possible by default, but would be great if you could provide some kind of direction.

@desandro
Copy link
Member

it means to kind of “split” the group and understand that it might not be possible by default

Yeah, that is how groupCells is designed to work. If you need to align individual cells, then you cannot use groupCells. There is no API to workaround this behavior.

desandro added a commit that referenced this issue Jan 29, 2019
add selectInitialIndex

✅ initialIndex tests
@desandro
Copy link
Member

desandro commented Jan 29, 2019

In v2.2.0, you can now set initialIndex to a selector string. This will select the corresponding slide that contains the cell with the selector. I'm closing this issue as fixed.

initialIndex: '.is-initial-select'
<div class="carousel-cell">...</div>
<div class="carousel-cell">...</div>
<div class="carousel-cell is-initial-select">...</div>

If you run into a problem with this feature, please open a new issue. Thank you for your input 🌈🐻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants