fancyapps / ui

A library of JavaScript UI components, includes the best lightbox - Fancybox5
https://fancyapps.com/
Other
722 stars 91 forks source link

Fancybox: Set custom animate source element #618

Closed AndersMad closed 4 months ago

AndersMad commented 4 months ago

Is your feature request related to a problem? Please describe.

Setup: A list of images changes a "big main image" on click (swaps src etc.). The fancybox is shown from a click on the main image (and starts with a startIndex from the image last selected / shown in the main image)

Problem: The animation comes from the image in the list - it should come from the "main image".

Describe the solution you'd like

An option so set the bounds from the animation should happen/start from - or specify such an element (easier).

Describe alternatives you've considered

No response

Additional context

No response

fancyapps commented 4 months ago

Hi, Can you, please, create simple demo? I do not understand what do you mean by "big main image", etc.

AndersMad commented 4 months ago

x number of thumbnails changes an image that is not in the pool of fancy boxed item - but I want the animation to come from that image as thats the one that triggers the fancybox. The thumbnails does not trigger fancy box - they change the big image.

But I can try make a simple sample.

fancyapps commented 4 months ago

If you use trigger element feature, then it works as you describe - https://jsfiddle.net/Lkgo4b9x/ - or I do not understand, a demo would help

AndersMad commented 4 months ago

I am not using bind, so not sure how to apply it. Here is a sample / repro: https://jsfiddle.net/jgu9ef52/2/

fancyapps commented 4 months ago

Here is one possible solution - https://jsfiddle.net/ue6Lp5w3/

AndersMad commented 4 months ago

cool! thanks - it works perfectly! :)