Closed maxkopych closed 1 year ago
Hi,
Please, upgrade to v5.
after upgrade to v5 it's stop working in vue2. Is it any instruction for that?
Hi, I don't know what problem you have, but you can always import Fancybox files directly into your page.
Sorry for not providing more details. for v4 version I have code. Initialization:
import {Fancybox} from "@fancyapps/ui/src/Fancybox/Fancybox.js";
Fancybox.bind(".slick-slide:not(.slick-cloned) .fancybox", {
groupAll: true,
Toolbar: {
display: [
{ id: "prev", position: "center" },
{ id: "counter", position: "center" },
{ id: "next", position: "center" },
"close",
],
},
Thumbs: {
autoStart: true,
},
})
And then in vue template I just add attributes to element:
<Slider :options="sliderOptions">
<div
v-for="slide in data.slides"
data-fancybox="video-gallery"
:data-src="slide.video_url"
class="mkSlide px-2"
:class="slide.type"
:data-thumb="getThumbURL(slide)"
>
<div class="imgBox" :style="{backgroundImage: getThumbURL(slide, true)}">
<div class="videoLink"><img :src="playButton"/></div>
</div>
</div>
</Slider>
So after upgrade I just updated import code to:
import { Fancybox } from "@fancyapps/ui/dist/fancybox/fancybox.esm.js";
import "@fancyapps/ui/dist/fancybox/fancybox.css";
But I just found this instruction it's look like in v5 I have to manually init Fancybox on each mount? I think previous it was observing DOM changes?
Yes, you have to tell Fancybox to listen for click events as described here - https://fancyapps.com/fancybox/getting-started/#option-1-declarative
This way you can set custom options for each component individually:
Fancybox.bind(REFERENCE_TO_YOUR_CONTAINER, "[data-fancybox]", {
// Your custom options
});
When trying to import css:
I'm getting error
.browserslistrc:
package.json: