How to Organize Slide Loading in Fancybox 5 for an Album with Multiple Pages? #689
Unanswered
Everett-Young
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Hi, Sorry, but I couldn't understand why you want to add slides, like why you can't just include all the photos in the gallery.
Sorry, there is a |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
I'm working on a project where I use Fancybox to display photos from an album. Each page of the album can contain between 1 and 10 photos, and the total number of pages can vary (N pages).
Here's what I'm trying to achieve:
Initial Setup: When the album page is opened, I use Fancybox.bind to initialize Fancybox for the photos on that specific page.
Slide Loading: While viewing the photos in Fancybox, I need to dynamically load photos from other pages. Specifically:
Given this setup, what would be the best way to organize the slide loading in Fancybox5? How can I efficiently manage this dynamic loading while ensuring a smooth user experience? Any advice or best practices would be greatly appreciated.
What I've Tried So Far:
I attempted to implement the dynamic slide loading using the beforeChange event in Fancybox, with the following approach:
On the Left Edge: If the user tries to navigate back from the first photo on the current page, I used prependSlide to add the slides from the previous page to the start of the slider. After adding the new slides, I called slidePrev to navigate to the last photo of the newly added slides.
On the Right Edge: Similarly, if the user navigates forward from the last photo on the current page, I used appendSlide to add the slides from the next page to the end of the slider. After adding the new slides, I called slideNext to proceed to the first photo of the newly added slides.
In both cases, I used preventDefault in the beforeChange event to cancel the native transition behavior.
However, I’ve encountered an issue where there’s a noticeable visual flicker or jump with the photo being transitioned from. I suspect this occurs because all the slides are being rebuilt or re-rendered after the new slides are added, which disrupts the smoothness of the transition.
Additional Question:
Is there a setting in Fancybox that allows the [navigation arrows, infobar, thumbs] to be displayed even when there's only one photo in the slider?
Beta Was this translation helpful? Give feedback.
All reactions