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

For custom toolbar icons, get properties from open image #129

Closed
daften opened this issue Aug 23, 2020 · 2 comments
Closed

For custom toolbar icons, get properties from open image #129

daften opened this issue Aug 23, 2020 · 2 comments

Comments

@daften
Copy link

daften commented Aug 23, 2020

E.g. to add a delete action, we need to know the URL / id of the current photo. Is this possible. Is it possible to pass the image object for the open/active image to the function being called?

https://fslightbox.com/javascript/documentation/toolbar

@piotrzdziarski
Copy link
Collaborator

piotrzdziarski commented Nov 29, 2020

In 3.3.0 FsLightbox instance is passed as param to custom toolbar button onclick. So you can get the current source URL like this:

fsLightboxInstances['gallery'].props.customToolbarButtons = [{
  onClick: (instance) => {
    console.log(instance.props.sources[instance.stageIndexes.current]);
  }
}]; 

@daften
Copy link
Author

daften commented Oct 18, 2021

Instead of the lightboxinstance, I get a PointerEvent though :s

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