Skip to content

idleTime option for v4? #306

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

You must be logged in to vote

Hi,

Sorry, there is currently no built-in option for that, but it is on the to-do list. But you could easily create using API, here is a quick example:

const Idle = {
  timer: null,
  set: () => {
    Idle.timer = setTimeout(() => {
      Fancybox.getInstance().$container.classList.add("is-idle");
    }, 1000);
  },
  end: () => {
    clearTimeout(Idle.timer);
    Fancybox.getInstance().$container.classList.remove("is-idle");
  },
};

Fancybox.bind('[data-fancybox="gallery"]', {
  on: {
    ready: (fancybox) => {
      Idle.set();

      fancybox.$container.addEventListener("mousemove", function (event) {
        Idle.end();
        Idle.set();
      });
    },
  },
});
.fancybox__container[

Replies: 1 comment 1 reply

Comment options

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

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