jssor full height or full screen slider / possible?

后端 未结 3 1238
星月不相逢
星月不相逢 2020-12-05 21:10

is it possible to make this demo http://www.jssor.com/demos/full-width-slider.html to full screen height ? like supersizes carousel http://buildinternet.c

3条回答
  •  萌比男神i
    2020-12-05 21:26

    please use following code to scale slider to full screen,

    //responsive code begin
    //you can remove responsive code if you don't want the slider scales while window resizes
    function ScaleSlider() {
        var windowWidth = $(window).width();
    
        if (windowWidth) {
            var windowHeight = $(window).height();
            var originalWidth = jssor_slider1.$OriginalWidth();
            var originalHeight = jssor_slider1.$OriginalHeight();
    
            var scaleWidth = windowWidth;
            if (originalWidth / windowWidth > originalHeight / windowHeight) {
                scaleWidth = Math.ceil(windowHeight / originalHeight * originalWidth);
            }
    
            jssor_slider1.$ScaleWidth(scaleWidth);
        }
        else
            window.setTimeout(ScaleSlider, 30);
    }
    
    ScaleSlider();
    
    $(window).bind("load", ScaleSlider);
    $(window).bind("resize", ScaleSlider);
    $(window).bind("orientationchange", ScaleSlider);
    //responsive code end
    

    and wrap the slider container

    Please visit Full Screen Slider with source code.

提交回复
热议问题