resize(slide = null) {
        slide = !slide ? this.activeSlide : slide;

        if (!slide || _.hasClass(slide, 'zoomed')) {
            return;
        }

        const winSize = _.windowSize();
        const video = slide.querySelector('.gvideo-wrapper');
        const image = slide.querySelector('.gslide-image');
        const description = this.slideDescription;

        let winWidth = winSize.width;
        let winHeight = winSize.height;

        if (winWidth <= 768) {
            _.addClass(document.body, 'glightbox-mobile');
        } else {
            _.removeClass(document.body, 'glightbox-mobile');
        }

        if (!video && !image) {
            return;
        }

        let descriptionResize = false;
        if (description && (_.hasClass(description, 'description-bottom') || _.hasClass(description, 'description-top')) && !_.hasClass(description, 'gabsolute')) {
            descriptionResize = true;
        }

        if (image) {
            if (winWidth <= 768) {
                let imgNode = image.querySelector('img');
                //imgNode.setAttribute('style', '');
            } else if (descriptionResize) {
                let descHeight = description.offsetHeight;
                let imgNode = image.querySelector('img');

                // if a slide height is set via data-height, we want to use that
                // if not, we fall back to 100vh
                const slideTriggerNode = this.elements[this.index]?.node;
                let maxHeightValue = '100vh';
                if (slideTriggerNode) {
                    maxHeightValue = slideTriggerNode.getAttribute('data-height') ?? maxHeightValue;
                }

                imgNode.setAttribute('style', `max-height: calc(${maxHeightValue} - ${descHeight}px)`);
                description.setAttribute('style', `max-width: ${imgNode.offsetWidth}px;`);
            }
        }

        if (video) {
            let ratio = _.has(this.settings.plyr.config, 'ratio') ? this.settings.plyr.config.ratio : '';

            if (!ratio) {
                // If no ratio passed, calculate it using the video width and height
                // generated by Plyr
                const containerWidth = video.clientWidth;
                const containerHeight = video.clientHeight;
                const divisor = containerWidth / containerHeight;
                ratio = `${containerWidth / divisor}:${containerHeight / divisor}`;
            }

            let videoRatio = ratio.split(':');
            let videoWidth = this.settings.videosWidth;
            let maxWidth = this.settings.videosWidth;

            if (_.isNumber(videoWidth) || videoWidth.indexOf('px') !== -1) {
                maxWidth = parseInt(videoWidth);
            } else {
                // If video size is vw, vh or % convert it to pixels,
                // fallback to the current video size
                if (videoWidth.indexOf('vw') !== -1) {
                    maxWidth = (winWidth * parseInt(videoWidth)) / 100;
                } else if (videoWidth.indexOf('vh') !== -1) {
                    maxWidth = (winHeight * parseInt(videoWidth)) / 100;
                } else if (videoWidth.indexOf('%') !== -1) {
                    maxWidth = (winWidth * parseInt(videoWidth)) / 100;
                } else {
                    maxWidth = parseInt(video.clientWidth);
                }
            }

            let maxHeight = maxWidth / (parseInt(videoRatio[0]) / parseInt(videoRatio[1]));
            maxHeight = Math.floor(maxHeight);

            if (descriptionResize) {
                winHeight = winHeight - description.offsetHeight;
            }

            if (maxWidth > winWidth || maxHeight > winHeight || (winHeight < maxHeight && winWidth > maxWidth)) {
                let vwidth = video.offsetWidth;
                let vheight = video.offsetHeight;
                let ratio = winHeight / vheight;
                let vsize = { width: vwidth * ratio, height: vheight * ratio };
                video.parentNode.setAttribute('style', `max-width: ${vsize.width}px`);

                if (descriptionResize) {
                    description.setAttribute('style', `max-width: ${vsize.width}px;`);
                }
            } else {
                video.parentNode.style.maxWidth = `${videoWidth}`;
                if (descriptionResize) {
                    description.setAttribute('style', `max-width: ${videoWidth};`);
                }
            }
        }
    }
Handle resize
Create only to handle
when the height of the screen
is lower than the slide content
this helps to resize videos vertically
and images with description