2012-02-13 50 views
-1

我試圖讓燈箱運行在我的畫廊。自從我通過documet.ready()函數中的alert()來測試它之後,jquery就可以工作。但除了燈箱似乎沒有工作。或者至少我只有鏈接正常工作。這裏是我的代碼:燈箱不工作,雖然jquery被加載

<!DOCTYPE html>  
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">  
<head>  

<title></title>  
<meta charset="UTF-8" />  
<meta name="ROBOTS" content="ALL" />  
<meta name="MSSmartTagsPreventParsing" content="true" />  

<meta name="keywords" content="" />  
<meta name="description" content="" />  

<link href='http://fonts.googleapis.com/css?family=Raleway:100' rel='stylesheet' type='text/css'>  

<link href="/fuelcms/assets/css/klang.css?c=943916400" media="all" rel="stylesheet"/>  

<base href="http://localhost/fuelcms/index.php" />  

<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />  
<meta name="robots" content="index, follow" />  

<script type="text/javascript" src="assets/js/jquery.js"></script>  
<script type="text/javascript" src="assets/js/lightbox/prototype.js"></script>  
<script type="text/javascript" src="assets/js/lightbox/scriptaculous.js?load=effects,builder"></script>  
<script type="text/javascript" src="assets/js/lightbox/lightbox.js"></script>  
<link rel="stylesheet" href="assets/css/lightbox.css" type="text/css" media="screen" />  

</head>  


<body class="gallery index">  
<!--<div class="header"><ul>  
<li class="first"><a href="http://localhost/fuelcms/index.php/repertoire" title="Repertoire">Repertoire</a></li>  
<li><a href="http://localhost/fuelcms/index.php/about" title="&Uuml;ber uns">&Uuml;ber uns</a></li>  
<li><a href="http://localhost/fuelcms/index.php/kontakt" title="Kontakt">Kontakt</a></li>  
<li><a href="http://localhost/fuelcms/index.php/agenda" title="Agenda">Agenda</a></li>  
<li><a href="http://localhost/fuelcms/index.php/gallery" title="Gallerie">Gallerie</a></li>  
<li class="last"><a href="http://localhost/fuelcms/index.php/links" title="Links">Links</a></li>  
</ul>  
</div>-->  

<ul>  
<li class="first"><a href="http://localhost/fuelcms/index.php/repertoire" title="Repertoire">Repertoire</a></li>  
<li><a href="http://localhost/fuelcms/index.php/about" title="&Uuml;ber uns">&Uuml;ber uns</a></li>  
<li><a href="http://localhost/fuelcms/index.php/kontakt" title="Kontakt">Kontakt</a></li>  
<li><a href="http://localhost/fuelcms/index.php/agenda" title="Agenda">Agenda</a></li>  
<li><a href="http://localhost/fuelcms/index.php/gallery" title="Gallerie">Gallerie</a></li>  
<li class="last"><a href="http://localhost/fuelcms/index.php/links" title="Links">Links</a></li>  
</ul>  

<div class="fullpage">  
<div class="colmask">  
<div class="col3">  

<div class="pagination"><a href="http://localhost/fuelcms/index.php/gallery/index/">&lsaquo; First</a>&nbsp;&nbsp;<a href="http://localhost/fuelcms/index.php/gallery/index/7">&lt;</a>&nbsp;<a href="http://localhost/fuelcms/index.php/gallery/index/6">7</a>&nbsp;<a href="http://localhost/fuelcms/index.php/gallery/index/7">8</a><strong>9</strong></div><br><div class="imagebox"><a rel="lightbox[col]" href="assets/images/fotos_site/Gong.JPG"><img src="http://localhost/fuelcms/assets/images/fotos_site/thumbs/Gong_thumb.jpg" alt=""/></a></div><div class="imagebox"><a rel="lightbox[col]" href="assets/images/fotos_site/Fatamorganaschatten.JPG"><img src="http://localhost/fuelcms/assets/images/fotos_site/thumbs/Fatamorganaschatten_thumb.jpg" alt=""/></a></div><div class="imagebox"><a rel="lightbox[col]" href="assets/images/fotos_site/Bumentopf2.JPG"><img src="http://localhost/fuelcms/assets/images/fotos_site/thumbs/Bumentopf2_thumb.jpg" alt=""/></a></div><div class="imagebox"><a rel="lightbox[col]" href="assets/images/fotos_site/Blumentopfdynamik.JPG"><img src="http://localhost/fuelcms/assets/images/fotos_site/thumbs/Blumentopfdynamik_thumb.jpg" alt=""/></a></div><div class="imagebox"><a rel="lightbox[col]" href="assets/images/fotos_site/Blumentopf.JPG"><img src="http://localhost/fuelcms/assets/images/fotos_site/thumbs/Blumentopf_thumb.jpg" alt=""/></a></div><div class="imagebox"><a rel="lightbox[col]" href="assets/images/fotos_site/Blument1.JPG"><img src="http://localhost/fuelcms/assets/images/fotos_site/thumbs/Blument1_thumb.jpg" alt=""/></a></div></div></div><div class="footer" />  
</body>  
</html> 

我也嘗試過頭標記中的腳本標記,但沒有區別,請幫助。

greez almightybob

+1

那些腳本標記內的數字是故意的嗎? – rcdmk 2012-02-13 23:07:54

+3

你爲什麼使用這樣一箇舊版本? [Lightbox 2.05](http://lokeshdhakar.com/projects/lightbox2/#download)已經有相當長一段時間了......或者我正在談論一個不同的插件? – elclanrs 2012-02-13 23:07:56

+0

你有沒有嘗試刪除at標誌? $( '一個[相對* =收藏夾]')燈箱(); – 2012-02-13 23:13:26

回答

3
  • 你編碼XHTML(使用自結束標記),但不聲明XHTML文檔類型。在SO

  • <link><meta><base>是自閉自行檢查this question,但是,<script>應始終由</script>的安全措施關閉,不管外部或內部。我的IDE(Aptana Studio 3)這樣做(知道它有內置驗證,在我看來它必須是「最佳實踐」)

  • 雖然不確定,但我認爲在選擇時可以省略@燈箱使用最新的jQuery:$('a[rel*=lightbox]').lightBox()

  • 多久以前是1.4?嘗試更新的jQuery版本!

1

我有這個問題之前,解決它通過將以下正確的結束標記之前:

<script> 
    $.noConflict(); 
</script> 

也許這會幫助你。

注意:這適用於我使用Google CDN上託管的最新jQuery(1.7.1)和Lightbox 2.05 located here。您是否使用不同的燈箱實施?如果沒有,你肯定會堅持jQuery和Lightbox的舊版本。

+0

Snipped沒有做出任何差別或沒有它,謝謝雖然 – almightyBob 2012-02-14 14:23:49