ui icon indicating copy to clipboard operation
ui copied to clipboard

Fancybox protect option no longer exist in v4.0

Open n-rodriguez opened this issue 3 years ago • 1 comments

Before : https://github.com/fancyapps/fancybox/search?q=protect After : https://github.com/fancyapps/ui/search?q=protect

The feature : https://github.com/fancyapps/fancybox/blob/c4fd90370f8c93336d6e36a5c6120bcabcf8675c/docs/index.html#L579-L582

To resume: with Fancybox v4 you can right click and download images even if the protect option is true. (of course, the feature no longer exists...)

n-rodriguez avatar Sep 12 '22 17:09 n-rodriguez

I'm was able to workaround this with :

    window.Fancybox.bind '[data-fancybox]',
      on:
        load: (fancybox, slide) =>
          $(slide.$content).on "contextmenu.fb", (e) ->
            if e.button == 2
              e.preventDefault()
            return true

but the "missing feature" issue it's pretty unexpected.

n-rodriguez avatar Sep 12 '22 17:09 n-rodriguez

I wonder if anyone can help further, have tried @n-rodriguez solution but could not get to work.

oliversmiths avatar Nov 30 '22 20:11 oliversmiths

@oliversmiths Here is an example:

Fancybox.bind('[data-fancybox]', {
  on: {
    load: (fancybox, slide) => {
      slide.$content.addEventListener("contextmenu", (e) => {
        e.preventDefault()
      });
    }
  }
});

fancyapps avatar Dec 02 '22 10:12 fancyapps

Many thanks – works perfectly

oliversmiths avatar Dec 02 '22 13:12 oliversmiths

I used a css class:

// Prevent fancybox images download
.fancybox__container img
  pointer-events: none

SamuelGaona avatar Dec 29 '22 06:12 SamuelGaona

Hi, protected option is now available in v5, use it like this:

Fancybox.bind('[data-fancybox="gallery"]', {
  Images : {
    protected: true
  }
});  

https://jsfiddle.net/vaqhwy1L/

fancyapps avatar Mar 12 '23 12:03 fancyapps

Hi, protected option is now available in v5, use it like this:

Thank you!

n-rodriguez avatar Mar 17 '23 00:03 n-rodriguez