featherlight
featherlight copied to clipboard
Featherlight displays the image even thou "beforeOpen" is asked to return false (in order to prevent image from showing if certain condition apply)
What kind of issue is this? (put 'x' between the square brackets)
-
[ ] Question. This issue tracker is not the place for questions. If you want to ask how to do something, or to understand why something isn't working the way you expect it to, use http://stackoverflow.com/questions/ask . Provide working code, starting from http://jsfiddle.net/JNsu6/15/. We monitor the tag
featherlight.js
. -
[x ] Bug report. If you’ve found a bug, you must provide a minimal example in a CodePen, starting from http://jsfiddle.net/JNsu6/15/ .
-
[ ] Feature Request. Make sure there's no good way to do what you want first; consider asking on http://stackoverflow.com/questions/ask first.
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.
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/