Skip to content
Discussion options

You must be logged in to vote

Hi,

You can archive the same functionality using shouldClose event, just make sure you are using the latest version.

Fancybox.bind('[data-fancybox="trigger-modal"]', {
  closeButton: false,
  dragToClose: false,
  click: false,

  on: {
    shouldClose: function (fancybox, event) {
      const value =
        event && event.target ? parseInt(event.target.dataset.value, 10) : 0;

      console.log(`value: ${value}`);

      if (value !== 1) {
        return false;
      }
    },
  },
});

Demo - https://fancyapps.com/playground/1W2
(Note: That demo will work fine after CDN will update to the latest)

Replies: 2 comments 4 replies

Comment options

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

Answer selected by DamienIngrand
Comment options

You must be logged in to vote
3 replies
@brendon
Comment options

@fancyapps
Comment options

@brendon
Comment options

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