Skip to content

Hash-based navigation for ajax loaded gallery #210

Answered by fancyapps
snitchyuk asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,

The latest release added support for custom hash for manually opened galleries. Upgrade and use it like this:

Fancybox.show(data, {slug : 'gallery'});

Keep in mind that this will just add #gallery to URL and will remove when Fancybox closes, even when back button is used. But, if user will later use forward button, then browser will add #gallery, but Fancybox will not start. The same will happen if user opens page with already included hash value. So, if you want to provide full functionality, you will have to implement it yourself. Here is an example:

const gallery_items = [
  {
    src: 'https://lipsum.app/id/32/1600x1200',
    thumb: 'https://lipsum.app/id/32/200x150',
  },
  {
    s…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@snitchyuk
Comment options

Answer selected by snitchyuk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants