leaffm / react-infinite-carousel

React simple infinite carousel with lazy loading and responsive support
MIT License
116 stars 19 forks source link

Anchor tag not going to hyperlink #26

Closed GauravThakur03 closed 4 years ago

GauravThakur03 commented 4 years ago

I have anchor tags as children to InfiniteCarousel component. On click of child item its not going to the given href hyperlink.

gl0gl0 commented 4 years ago

Hi, I've used it with hyperlinks before and works for me. Do you happen to have any code snippet?

GauravThakur03 commented 4 years ago

Hi gl0gl0, Thanks for reply

This is my code snippet :

<InfiniteCarousel breakpoints={[ { breakpoint: 500, settings: { slidesToShow: 1, slidesToScroll: 1, }, }, { breakpoint: 768, settings: { slidesToShow: 2, slidesToScroll: 1, }, }, { breakpoint: 992, settings: { slidesToShow: 3, slidesToScroll: 1, }, }

                    ]}
                    arrows={true}
                    responsive={true}
                    showSides={false}
                    sidesOpacity={1}
                    sideSize={0}
                    slidesToScroll={1}
                    slidesToShow={4}
                    scrollOnDevice={true}
                    slidesSpacing={5}
                >

                    {data.map((item, index) => {

                        return (
                            <a href={item.link} target="_blank" tabIndex="0" key="index" >
                                <Card key="index">
                                    <Card.Img
                                        variant="top"
                                        alt={item.title}
                                        style={{ height: '180px', width: '100%', display: 'block' }}
                                        src={item.image}
                                    />
                                    <Card.Body>
                                        <Card.Title>{item.title}</Card.Title>
                                        <Card.Text style={{ color: '#333' }}>
                                            {item.description}
                                        </Card.Text>
                                    </Card.Body>
                                </Card>
                            </a>
                        )
                    })}

                </InfiniteCarousel>
gl0gl0 commented 4 years ago

Hi GauravThakur03,

True! I just checked and you're right! Something that I changed in the last big version must have affected.

I just found out what it is going on and it seems related to performance, render is being called more times than it should and it's preventing the click event from going through somehow. I'll dig more into this and let you know how it goes.

Thank you for logging this :).

gl0gl0

gl0gl0 commented 4 years ago

This issue has been resolved in latest version v2.0.1