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

Left Right Buttons not working #54

Open
Hsay28 opened this issue Oct 28, 2022 · 2 comments
Open

Left Right Buttons not working #54

Hsay28 opened this issue Oct 28, 2022 · 2 comments

Comments

@Hsay28
Copy link

Hsay28 commented Oct 28, 2022

Here is my code

const [currentImageIndex, setCurrentIndex] = useState(0);

const gotoPrevious = () =>
currentImageIndex > 0 && setCurrentIndex(currentImageIndex - 1);

const gotoNext = (GalleryImages: any) => {
console.log(currentImageIndex);
currentImageIndex + 1 < GalleryImages.length &&
setCurrentIndex(currentImageIndex + 1);
};

<Lightbox
isOpen={true}
className="bg-black/70"
onClose={() => setIsLightboxView(false)}
onNext={() => gotoNext(GalleryImages)}
onPrev={gotoPrevious}
singleClickToZoom
images={GalleryImages.map((photo: any) => ({
src: photo.src,
alt: photo.alt,
}))}
currentIndex={currentImageIndex}
renderPrevButton={() => (
<IoIosArrowBack
className={text-5xl text-primary absolute left-20 cursor-pointer}
/>
)}
renderNextButton={() => (
<IoIosArrowForward
className={text-5xl text-primary absolute right-20 cursor-pointer}
/>

@tim-soft
Copy link
Owner

could you make a codesandbox?

@paulopgss
Copy link

paulopgss commented Jul 26, 2023

I really liked the lib, very easy to apply everything. So I will answer you because I went through the same problem, although I believe that by the time you must have already changed the lib or done something without the aid of a lib. The fact is that the z-index of the image is on the button, so you can not apply, check your css if you still use the lib that should already solve. Applying a z-index of 2 on the buttons worked for me. I hope I have helped and if other people go through the problem can consult this issue

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

No branches or pull requests

3 participants