remove the class after closing fancybox 4

54 Views Asked by At

in version 3 it was like this:

$("[data-fancybox]").fancybox({
    afterClose: function () {
        //window.location.reload();
        $(".modal-content").removeClass("active");
    },
});

How to write the same in version 4?

1

There are 1 best solutions below

0
Александр Орлов On BEST ANSWER
Fancybox.bind('[data-fancybox]', {
 on: {
  destroy: function (fancybox, event) {
   document.querySelectorAll('.modal-content').forEach(function (content) {
    content.classList.remove('active');
   });
  },
 },
});