I've created a custom button in the toolbar as instructed here:
https://fancyapps.com/fancybox/3/docs/#faq-3
I want to pass the image ID to the click function - can I do this?
Thanks!
You do not need to pass anything. This is how you can access trigger element (e.g., the link you clicked to open current image) from anywhere in the code:
$.fancybox.getInstance().current.opts.$orig
You can add some attribute to your links (like data-image-id
) and then just read it when needed (from your click event).