JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0/dist/carousel/carousel.css"
/>
<style>
html, body {
margin: 0;
padding: 0;
}
#myCarousel {
--f-carousel-spacing: 10px;
--f-carousel-slide-width: 100%;
}
#myCarousel .f-carousel__slide {
padding: 50px;
background: #eee;
}
.f-carousel.in-fullscreen {
position: fixed;
top: 0;
left: 0;
margin: 0 !important;
width: 100% !important;
height: 100% !important;
max-width: none !important;
max-height: none !important;
aspect-ratio: unset !important;
z-index: 10;
}
.f-carousel.in-fullscreen .f-carousel__dots {
bottom: 0;
}
#toggleFS {
position: fixed;
top: 10px;
left: 10px;
z-index: 20;
}
</style>
</head>
<body>
<div>
<button id="toggleFS">
Toggle fullscreen
</button>
<div class="f-carousel" id="myCarousel">
<div class="f-carousel__slide">1</div>
<div class="f-carousel__slide">2</div>
<div class="f-carousel__slide">3</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0/dist/carousel/carousel.umd.js"></script>
<script>
const myCarousel = new Carousel(document.getElementById("myCarousel"), {
on : {
"Panzoom.enterFS": (carousel, eventName) => {
carousel.container.classList.add("in-fullscreen");
},
"Panzoom.exitFS": (carousel, eventName) => {
carousel.container.classList.remove("in-fullscreen");
},
}
});
document.getElementById("toggleFS").addEventListener("click", () => {
...