jechav / tiny-slider-react

wrapper of tiny-slider plugin for react.
https://tiny-slider-react-tests.netlify.app/
47 stars 27 forks source link

onClick stops working once an images loop #66

Open erikksuzuki opened 1 year ago

erikksuzuki commented 1 year ago

      <TinySlider onClick={showSlideInfo} settings={settings}>
        {sideImages.map((image: any, index: number) => {
          return (
            <div className="relative w-[140px]" key={`sideimage-${index}`}>
              <img
                id={`slideid-${image.index}`}
                src={image.src}
                className="cursor-pointer w-full opacity-50 hover:opacity-100 transition-all"
                style={{
                  transitionProperty: 'all',
                  transitionTimingFunction: 'cubic-bezier(0.4, 0, 0.2, 1)',
                  transitionDuration: '400ms',
                }}
                onClick={() => openLightbox(image.src)}
              />
            </div>
          )
        })}
      </TinySlider>
    </div>```

openLightbox() works the first time the slider goes through the images, but after the loop it the onClick property seems to disappear entirely.