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

Featherlight displays the image even thou "beforeOpen" is asked to return false (in order to prevent image from showing if certain condition apply) #429

Open
2 tasks
camelico opened this issue Oct 22, 2023 · 1 comment

Comments

@camelico
Copy link

What kind of issue is this? (put 'x' between the square brackets)

I am trying to show an image with featherlight, but would like the lightbox not to popup if certain conditions apply, so following the documentation, and as far as I understand, "return false" on "beforeOpen" should prevent the opening of the image. I tried doing that based on documentation + research, and the "beforeOpen" is triggered, but "return false" does not prevent the lightbox from opening, which is the main idea.

Link to JSFiddle:
https://jsfiddle.net/9fgwsnku/

Thank you.

@seemly
Copy link

seemly commented Nov 7, 2023

I was interested in using this library, but before I did, I wanted to investigate a few of the GitHub Issues.

In your case, I tested your fiddle and found that by adding an event.preventDefault(); I believe this gives you the functionality you're looking for.

https://jsfiddle.net/bner7qzm/

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

2 participants