Drop event #564
Replies: 3 comments 2 replies
-
Hi, Since backdrop element is behind the carousel, I think you have to attach your event listener to the carousel slide, something like this: Fancybox.bind('[data-fancybox="gallery"]', {
on: {
"done": (fancybox, slide) => {
slide.el.addEventListener('drop', function(e) {
e.preventDefault();
console.log('works?');
});
},
},
}); |
Beta Was this translation helpful? Give feedback.
-
Thanks for the reply. The 'drop' event is not working. I changed it to 'mouseenter' and it works but when 'drop' happens, Firefox tries to open up the file instead. If the file is an image, it just leaves the current page and displays the image. |
Beta Was this translation helpful? Give feedback.
-
OK figured it out. The event 'dragover' on the body was causing it. The 'dragover' must be prevented for this to work. |
Beta Was this translation helpful? Give feedback.
-
Hello,
I'd like to catch a file drop event when the file is dropped on the backdrop area. How would you do it?
I've tried to do it manually but it doesn't work. Tried to catch it via adding event listerner to
Fancybox.getInstance().container
orFancybox.getInstance().container.querySelector('.fancybox__backdrop')
or evenFancybox.getInstance().container.querySelector('.fancybox__slide')
. None works.Beta Was this translation helpful? Give feedback.
All reactions