Skip to content

adding carousel function control inside content of modal? #76

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

You must be logged in to vote

If you are creating many links, you can make it easier by using this snippet:

Fancybox.bind("[data-fancybox]", {
  closeButton: "outside",
  on: {
    "Carousel.Panzoom.click": (fancybox, carousel, panzoom, e) => {
      if ("fancyboxPrev" in e.target.dataset) {
        e.stopPropagation();
        e.preventDefault();

        fancybox.prev();
      }

      if ("fancyboxNext" in e.target.dataset) {
        e.stopPropagation();
        e.preventDefault();

        fancybox.next();
      }
    },
  },
});

Then simply create links like this:

<p>Click <a href="#" data-fancybox-prev>here</a> to go to the previous slide.</p>
<p>Click <a href="#" data-fancybox-next>next</a> to go to the next sl…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

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

Answer selected by steverethink
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