2012-09-13 30 views
0

在这里我的JavaScript函数我想显示图像阵列图像应显示适合桌面屏幕大小,并告诉我在哪里纠正代码,请告诉我如果有任何其他解决方案是有这个组件显示图像适合桌面屏幕使用simplegallary.js图像数组列表

 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> 
+1

你的问题是什么? – Kyle

+0

这里的选框组件被用在许多图像中,但那里的大小是固定的,他们显示为这个我使用simpleGallery.js文件的小图像,然后我想显示图像应该是动态的适合屏幕大小eghttp ://www.gloster.com/去这个我想要这种方式来显示图像组件 –

+0

如果你有一个地方,在这种情况下gloster.com,你看到你需要的功能,为什么不开始抓住代码,看看它做了什么,它是如何工作的以及如何将它实现到你的?如果您遇到问题/问题,请在此提问。 –

回答

0

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

以下是你可以打电话获取屏幕尺寸信息的各种功能:

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

那么对你来说,你应该需要做的是改变dimensions

dimensions: [screen.height, screen.width] 

现在您的图片应该显示在这些尺寸上。