2012-09-13 33 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] 

現在您的圖片應該顯示在這些尺寸上。