2012-04-19 78 views
-1

我得到我的jquery畫廊的錯誤。當我結束腳本與靠近底部附近出現錯誤,我添加的Java for循環的照片從0-170命名爲:jquery畫廊無法工作

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script> 

<!-- load Galleria --> 
<script src="galleria-1.2.7.min.js"></script> 

</head> 
<body> 
    <div class="content"> 
     <h1>Galleria Classic Theme</h1> 
     <p>Demonstrating a basic gallery example.</p> 

     <!-- Adding gallery images. We use resized thumbnails here for better performance, but it’s not necessary --> 

<script src="jquery.js"></script> 
<script> 
$(document).ready 
     var galleria = $('#galleria') 
     for(var i=0;i<170;i++){  
     var imgName = "images/"+i+".JPG"  
     galleria.append('<a href="'+imgName+'"><img src="'+imgName+'"></a>') 
     { 


    // Load the classic theme 
    Galleria.loadTheme('galleria.classic.min.js'); 

    // Initialize Galleria 
    Galleria.run('#galleria'); 

     </script> 
    <script src="jquery.js"></script> 

    </body> 
</html> 
+0

真的很可怕的代碼格式,你可以請讓他們看起來更好? – 2012-04-19 02:01:51

+1

什麼是錯誤?我想這是一個解析器錯誤,因爲這個JavaScript無法成功解析。您缺少很多結構元素,例如括號和括號。 – David 2012-04-19 02:02:27

回答

0

認爲這可能是你裝的jquery.js三次

1

您正在從googleapis.com加載jQuery版本1。該插件插件可能需要更新版本的jQuery。

目前的版本是1.7.2:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script> 

http://docs.jquery.com/Downloading_jQuery#CDN_Hosted_jQuery

而且,你缺少大量的括號和括號。我也建議在你的臺詞結尾使用分號。

jQuery的ready函數接受一個函數作爲它的參數,所以你需要的東西是這樣的:

$(document).ready(function(){ 
    <your code here> 
});