gpt4 book ai didi

javascript - 使用图像数组列表的 simplegallary.js 显示适合桌面屏幕的图像

转载 作者:行者123 更新时间:2023-11-28 13:40:56 24 4
gpt4 key购买 nike

在这里我的 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>

最佳答案

确定屏幕尺寸的非常简单的 Javascript。

以下是您可以调用以获取屏幕尺寸信息的各种函数:

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

所以对于您来说,您需要做的就是将尺寸更改为

dimensions: [screen.height, screen.width]

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

关于javascript - 使用图像数组列表的 simplegallary.js 显示适合桌面屏幕的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12404737/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com