0

在这里我的javascript函数我想显示图像数组中的图像应该显示适合桌面屏幕大小并告诉我在哪里更正代码并请告诉我是否有任何其他解决方案适用于该组件

     var mygallery=new simpleGallery({
            wrapperid: "slideshow", //ID of main gallery container,
            dimensions: [960, 430], //width/height of gallery in pixels. Should reflect dimensions of the images exactly
            imagearray: [
                        ["http://www.sifasusa.com/Atimo_s/news/slide-show16.jpg", "", ""],
                ["http://www.sifasusa.com/Atimo_s/news/slide-show15.jpg", "", ""],
                        ["http://www.sifasusa.com/Atimo_s/news/slide-show14.jpg", "", ""],
                        ["http://www.sifasusa.com/Atimo_s/news/slide-show01.jpg", "", ""],  
                ["http://www.sifasusa.com/Atimo_s/news/slide-show02.jpg", "", ""],
                ["http://www.sifasusa.com/Atimo_s/news/slide-show12.jpg", "", ""],
                ["http://www.sifasusa.com/Atimo_s/news/slide-show03.jpg", "", ""],
                ["http://www.sifasusa.com/Atimo_s/news/slide-show04.jpg", "", ""],
                ["http://www.sifasusa.com/Atimo_s/news/slide-show05.jpg", "", ""],
                ["http://www.sifasusa.com/Atimo_s/news/slide-show08.jpg", "", ""],
                ["http://www.sifasusa.com/Atimo_s/news/slide-show13.jpg", "", ""],
                ["http://www.sifasusa.com/Atimo_s/news/slide-show09.jpg", "", ""],
                ["http://www.sifasusa.com/Atimo_s/news/slide-show10.jpg", "", ""],
                ["http://www.sifasusa.com/Atimo_s/news/slide-show11.jpg", "", ""]
                ],
            autoplay: [true, 2500, 8], //[auto_play_boolean, delay_btw_slide_millisec, cycles_before_stopping_int]
            persist: false, //remember last viewed slide and recall within same session?
            fadeduration: 500, //transition duration (milliseconds)
            oninit:function(){ //event that fires when gallery has initialized/ ready to run
                //Keyword "this": references current gallery instance (ie: try this.navigate("play/pause"))
            },
            onslide:function(curslide, i){ //event that fires after each slide is shown
                //Keyword "this": references current gallery instance
                //curslide: returns DOM reference to current slide's DIV (ie: try alert(curslide.innerHTML)
                //i: integer reflecting current image within collection being shown (0=1st image, 1=2nd etc)
            }
                });



html code
<body>
<div id="slideshow">
    <img src="http://www.sifasusa.com/Atimo_s/news/slide-show01.jpg">
</div>

</body>
4

1 回答 1

0

确定屏幕大小的真正简单的Javascript。

您可以调用以下各种函数来获取有关屏幕大小的信息:

screen.width
screen.height
screen.availWidth
screen.availHeight
screen.colorDepth
screen.pixelDepth

所以对你来说,你需要做的就是dimensions改变

dimensions: [screen.height, screen.width]

现在您的图像应该以这些尺寸显示。

于 2014-07-07T14:58:18.683 回答