2012-09-02 152 views
0

我最近開始爲朋友編寫一個網站,他問我是否可以在網站上添加幻燈片以顯示圖像。所以,因爲我不知道Javascript,所以我找到了一個可以使用的名爲SlidesJS的開源免費幻燈片。我已經設法自定義所有內容,但現在當圖像顯示在幻燈片上而不是滑過並顯示在幻燈片上時,它們將滑過整個屏幕覆蓋其他內容,因此變得非常煩人。我試過顯示器:沒有試圖隱藏圖像,因爲它們滑入位置,但它似乎不工作! 這裏是我的代碼:SlidesJS顯示:無法正常工作

HTML:

<div id="ss"> 

    <div id="slides"> 
     <div class="slides_container"> 
      <div class="slide"> 
       <a href="http://www.flickr.com/photos/jliba/4665625073/" title="145.365 - Happy Bokeh Thursday! | Flickr - Photo Sharing!" target="_blank"><img src="img/slide-1.jpg" width="692" height="395" alt="Slide 1"></a> 
      </div> 
      <div class="slide"> 
       <a href="http://www.flickr.com/photos/stephangeyer/3020487807/" title="Taxi | Flickr - Photo Sharing!" target="_blank"><img src="img/slide-2.jpg" width="690" height="395" alt="Slide 2"></a> 
      </div> 
      <div class="slide"> 
       <a href="http://www.flickr.com/photos/childofwar/2984345060/" title="Happy Bokeh raining Day | Flickr - Photo Sharing!" target="_blank"><img src="img/slide-3.jpg" width="690" height="395" alt="Slide 3"></a> 
      </div> 
      <div class="slide"> 
       <a href="http://www.flickr.com/photos/b-tal/117037943/" title="We Eat Light | Flickr - Photo Sharing!" target="_blank"><img src="img/slide-4.jpg" width="690" height="395" alt="Slide 4"></a> 
      </div> 
      <div class="slide"> 
       <a href="http://www.flickr.com/photos/bu7amd/3447416780/" title="&ldquo;I must go down to the sea again, to the lonely sea and the sky; and all I ask is a tall ship and a star to steer her by.&rdquo; | Flickr - Photo Sharing!" target="_blank"><img src="img/slide-5.jpg" width="690" height="395" alt="Slide 5"></a> 
      </div> 
      <div class="slide"> 
       <a href="http://www.flickr.com/photos/streetpreacher/2078765853/" title="twelve.inch | Flickr - Photo Sharing!" target="_blank"><img src="img/slide-6.jpg" width="690" height="395" alt="Slide 6"></a> 
      </div> 
      <div class="slide"> 
       <a href="http://www.flickr.com/photos/aftab/3152515428/" title="Save my love for loneliness | Flickr - Photo Sharing!" target="_blank"><img src="img/slide-7.jpg" width="690" height="395" alt="Slide 7"></a> 
      </div> 
     </div> 
     <a href="#" class="prev"><img src="img/arrow-prev.png" width="24" height="43" alt="Arrow Prev"></a> 
     <a href="#" class="next"><img src="img/arrow-next.png" width="24" height="43" alt="Arrow Next"></a> 
    </div> 
    <img src="img/example-frame.png" alt="Example Frame" name="frame" width="739" height="341" id="frame"> 
</div> 
<div class="clear"></div> 
</div> 

CSS:

#ss { 
width:900px; 
height:500px; 
position:relative; 
margin-left:30px; 
} 


#frame { 
position:absolute; 
z-index:0; 
width:900px; 
height:500px; 
top:-3px; 
left:-80px; 

} 

/* 
Slideshow 
*/ 

#slides { 
position:absolute; 
top:24px; 
left:24px; 
z-index:100; 
} 

/* 
Slides container 
Important: 
Set the width of your slides container 
Set to display none, prevents content flash 
*/ 

.slides_container { 
width:900px; 
overflow:hidden; 
position:relative; 
display:none; 
} 

/* 
Each slide 
Important: 
Set the width of your slides 
If height not specified height will be set by the slide content 
Set to display block 
*/ 

.slides_container div.slide { 
width:692px; 
height:395px; 
display:none; 
} 


/* 
Next/prev buttons 
*/ 

#slides .next,#slides .prev { 
position:absolute; 
top:165px; 
left:-44px; 
width:24px; 
height:43px; 
display:block; 
z-index:101; 
} 

#slides .next { 
left:710px; 
} 

/* 
Pagination 
*/ 

.pagination { 
margin:26px auto 0; 
width:100px; 
margin-left:260px; 
} 

.pagination li { 
float:left; 
margin:0 1px; 
list-style:none; 
} 

.pagination li a { 
display:block; 
width:12px; 
height:0; 
padding-top:12px; 
background-image:url(../img/pagination.png); 
background-position:0 0; 
float:left; 
overflow:hidden; 
} 

.pagination li.current a { 
background-position:0 -12px; 
} 




ThankYou in Advance. 
+3

你能給我們一個jsfiddle你的JavaScript嗎? – Oriol

回答

0

試着將一整個事情在一個div與給定的寬度和高度,並添加CSS屬性overflow:hidden;