1
我使用fancyBox版本:2.1.5與下面的代碼。標題不顯示在fancybox畫廊的第一個加載圖片
該畫廊完美無缺地初始化,無論從哪個圖像我開始。
但是無論我從哪個圖片開始畫廊,該圖片(和只有那個圖片)都不會顯示標題。所有其他圖像都正確顯示了他們的標題,但當我再次圍繞圖像旋轉時,標題從我開始的任何圖像中消失。
有誰知道我如何才能獲得標題,爲圖像展開工作?
我的代碼:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<link rel="stylesheet" href="scripts/jquery-ui/css/actonians-jqui/jquery-ui-1.10.1.custom.css" type="text/css">
<script src="scripts/jquery/jquery-1.9.0.js" type="text/javascript"></script>
<script src="scripts/jquery-ui/js/jquery-ui-1.10.0.custom.js" type="text/javascript"></script>
<link rel="stylesheet" href="scripts/fancyBox/source/jquery.fancybox.css" type="text/css" media="screen">
<script src="scripts/fancyBox/source/jquery.fancybox.pack.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$(".fancybox").fancybox({
wrapCSS : "fancybox-custom",
closeClick : true,
closeEffect: "fade",
openEffect : "fade",
helpers : {
title : {
type : "inside"
},
overlay : {
css : {
"background" : "rgba(160,160,160,0.65)"
}
}
}
});
});
</script>
</head>
<body>
<h1>Gallery</h1>
<p>Click an image below to view full size as a slideshow</p>
<div class="img_gallery">
<ul>
<li>
<a class="fancybox" data-fancybox-group="gallery1" href="photos/001.jpg" title="Title 1">
<img src="photos/thumbs/001.jpg" alt="Title 1">
</a>
</li>
<li>
<a class="fancybox" data-fancybox-group="gallery1" href="photos/002.jpg" title="Title 2">
<img src="photos/thumbs/002.jpg" alt="Title 2">
</a>
</li>
<li>
<a class="fancybox" data-fancybox-group="gallery1" href="photos/003.jpg" title="Title 3">
<img src="photos/thumbs/003.jpg" alt="Title 3">
</a>
</li>
</ul>
</div>
</body>
</html>
你可以創建一個js小提琴 – iJade
我想,因爲你正在添加一個自定義包裝'fancybox-custom'你的標題沒有拿起。嘗試添加API選項'title:this.title'來強制它。 – JFK
我還沒有定製「fancybox-custom」css,但它是「title:inside」選項所必需的(文檔iirc)。標題適用於除第一張以外的所有圖像。 – yknivag