-1
我創建一個簡單的畫廊和的fancybox似乎並沒有被解僱,我不知道爲什麼,我以前用它在其他網站和工程確定:的fancybox不點火
DOCTYPE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
腳本,CSS電話和js - 腳本源確定檢查
<link href="../js/fancybox/jquery.fancybox-1.3.4.css" rel="stylesheet" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="../js/fancybox/jquery.easing-1.3.pack.js" type="text/javascript"></script>
<script src="../js/fancybox/jquery.fancybox-1.3.4.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$("a[rel=gallery]").fancybox({
'autoScale' : true,
'transitionIn' : 'fade',
'transitionOut' : 'fade'
}
});
});
</script>
和我使用生成文件夾中的拇指PHP和也將href調用的fancybox
$files = glob("../gallery/gallery/*.*");
for ($i=1; $i<count($files); $i++)
{
$num = $files[$i]; echo '<a class="fancybox" rel=gallery href="'.$num.'">
<img src="'.$num.'" class="gallery_img" alt="random image"></a>';
}
這是從實際的網頁呈現的HTML:
<a class="fancybox" rel="gallery" href="../gallery/gallery/cat.jpg">
<img src="../gallery/gallery/cat.jpg" class="gallery_img" alt="random image">
</a>
<a class="fancybox" rel="gallery" href="../gallery/gallery/flypike.jpg">
<img src="../gallery/gallery/flypike.jpg" class="gallery_img" alt="random image">
</a>
<a class="fancybox" rel="gallery" href="../gallery/gallery/zandrb.jpg">
<img src="../gallery/gallery/zandrb.jpg" class="gallery_img" alt="random image"></a>
你在rel屬性上有一個錯字,該值沒有被引用。無論如何,你可以張貼呈現的HTML代碼片段嗎?你在JS控制檯上遇到任何錯誤? – mamoo 2012-02-29 09:43:04
做任何錯誤彈出螢火蟲/鉻調試器等? – Umair 2012-02-29 09:43:21
@Umair謝謝,控制檯發現語法錯誤 – 2012-02-29 10:08:51