Closed
Description
const slides = Array.from({ length: 4}).map((_, index) => (
<Box key={index} style={{
display: 'flex',
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center'
}}>
{bookData
.slice(index * itemPerPage, (index + 1) * itemPerPage)
.map((item:any, itemIndex:number) => {
return(
<Box key={itemIndex}>
<Paper style={{ margin: '0 15px', height: '300px', width: '200px', cursor: 'pointer', marginBottom: '12px'}}>
<img src={item.thumbnailUrl} alt='book' style={{height: '300px', width: '200px'}} loading='lazy'/>
</Paper>
<Typography sx={{fontSize: '12px', maxWidth: '200px',overflow: 'hidden', textOverflow: 'ellipsis',margin: '0 auto' }}>
{item.title}
</Typography>
</Box>
)})}
</Box>
));
<Carousel
showArrows={true}
emulateTouch={true}
showStatus={false}
showThumbs={false}
infiniteLoop={true}
autoPlay={true}
selectedItem={0}
renderArrowPrev={(onClickHandler, hasPrev, label) =>
hasPrev && renderCustomArrow(onClickHandler, label, 'prev')
}
renderArrowNext={(onClickHandler, hasNext, label) =>
hasNext && renderCustomArrow(onClickHandler, label, 'next')
}
className="custom-carousel-container"
>
{slides}
</Carousel>
Desktop (please complete the following information):
- OS: Windows
- Browser chrome
- Version 116.0.5845.141
If InfiniteLoop is True when the browser is rendered, it comes out from the end of the data even though the selectedItem is 0,
and if InfiniteLoop is False, it comes out from the beginning
When you see four items on a carousel page when the length of the data is 10
If there are 2 items on the last page, the last 2 items will be on the first carousel page when it is rendered for the first time, and if you go back to the beginning when you turn the carousel page, you will see 4 original data