ui
ui copied to clipboard
Fancybox protect option no longer exist in v4.0
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...)
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.
I wonder if anyone can help further, have tried @n-rodriguez solution but could not get to work.
@oliversmiths Here is an example:
Fancybox.bind('[data-fancybox]', {
on: {
load: (fancybox, slide) => {
slide.$content.addEventListener("contextmenu", (e) => {
e.preventDefault()
});
}
}
});
Many thanks – works perfectly
I used a css class:
// Prevent fancybox images download
.fancybox__container img
pointer-events: none
Hi, protected option is now available in v5, use it like this:
Fancybox.bind('[data-fancybox="gallery"]', {
Images : {
protected: true
}
});
https://jsfiddle.net/vaqhwy1L/
Hi,
protectedoption is now available in v5, use it like this:
Thank you!