-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Hi Nicolas, first of all great work on this lib! I was wondering if the line below is intentional and if it should be the other way around - currently the zIndex of each slide depends on an array index in an item. It seems odd to me because this makes the initial slide to be actually the last slide/item in an array.
https://github.com/NicolasSaikali/react-scroll-slider/blob/main/src/scroll-slider/index.tsx#L134
Replacing it with the following util function does the trick for me:
function getZIndexBasedOnIndex(
index: number,
slides: ScrollSlideType[]
): number {
if (index >= 0 && index < slides.length) {
return (slides.length - index) * 10
}
return 0
}
and then
zIndex: getZIndexBasedOnIndex(index, this.props.slides),
Metadata
Metadata
Assignees
Labels
No labels