F
F
Froggyweb2019-07-08 13:54:51
JavaScript
Froggyweb, 2019-07-08 13:54:51

Webpack and fancybox in global scope?

Good afternoon, there is a script with fancybox that is going to webpack

import fancybox from "../plugin/fancybox/jquery.fancybox"
$('[data-fancybox]').fancybox({
});
//...блабла бла...

Everything works great.

But there is a PHP script that I would like to call $.fancybox.close();
At the same time, the console issues $.fancybox - undefined. How to pass fancybox to global scope?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
Froggyweb, 2020-02-27
@Froggyweb

As soon as I invited an expert, everything worked out :)
window.fancybox = $.fancybox;
before that I tried to make window.fancybox = fancybox; :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question