2013-06-26 44 views
1

我想創建一個幻燈片循環之間的衆多不同的<div> s和由於某種原因,我不能讓幻燈片工作。我已經對它做了一些研究,而且一切似乎都應該起作用。我檢查了一遍又一遍的鏈接.js文件路徑,並確保我的腳本標籤都在正確的位置。jQuery循環插件不顯示幻燈片

我最後發生的一切就是三個圖像一個接一個地出現在瀏覽器窗口中。

這是代碼

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>Lorena Gaxiola</title> 
<style type="text/css"> 
body {background: #222; font-family:Georgia, "Times New Roman", Times, serif; font-size:11px; margin:50px; color:#999} 
ul li{line-height:20px;} 
.new{margin-top:15px} 
a{color:#fff; text-decoration:none; font-style:italic;} 
a:hover{text-decoration:underline} 
h1{font-size:16px; text-transform:uppercase; font-weight:normal; color:#fff; letter-spacing:1px;} 
h2{font-size:12px; text-transform:uppercase; font-weight:normal; color:#999; letter-spacing:1px;} 
#myslides img {height:500px; width:500px;} 
</style> 

<script type="text/javascript" src="jquery/jquery.cycle.all.js"></script> 
<script type="text/javascript" src="jquery/jquery-1.10.1.js"></script> 
<script type="text/javascript"> 
$(document).ready(function(){ 
$('#myslides').cycle({ 
fx: 'cover', 
speed: 500, 
timeout: 2000 
}); 
}); 
</script> 

</head> 

<body> 

<div id="myslides"> 
<div> 
<img style="500px;" src="http://images2.fanpop.com/images/photos/5800000/happy-kitten-kittens-5890512-1600-1200.jpg" /> 
</div> 
<div> 
<img src="http://images5.fanpop.com/image/photos/31400000/cute-kitten-in-marshmallows-cute-kittens-31462498-1914-1762.png" /> 
</div> 
<div> 
<img src="http://images2.fanpop.com/image/photos/9900000/so-cute-3-cute-kittens-9989494-1098-960.jpg" /> 
</div> 

</div> 
</body> 
</html> 

這些圖像現在是佔位符,他們需要在<div>其實如此我後來的風格他們更容易。有人知道我爲什麼不能讓我的幻燈片工作?

回答

2

首先包括jQuery的,然後jQuery的週期:

<script type="text/javascript" src="jquery/jquery-1.10.1.js"></script> 

<script type="text/javascript" src="jquery/jquery.cycle.all.js"></script> 

,它應該工作。順便說一下,<img style="500px;"應該改變,我想你想設置寬度?

+0

這樣做。似乎我忘記了編程101.你能澄清你所說的其他內容應該改變嗎? – qaxf6auux

+0

那麼......你應該設置適當的CSS聲明 - >屬性:值,例如寬度:500像素;身高:250px ... – sinisake

+0

啊,我在主文檔中擺脫了這一點。謝謝你抓住它。 – qaxf6auux