有没有一种方法可以从<img>
标签取代标签而不是<a>
标签?来自img标签的Fancybox标题不是href
例如 HTML:
<a rel="fancybox" href="#">
<img src="ball.jpg" title="this is the caption i want to show in fancybox" alt="alt text here" />
</a>
<a rel="fancybox" href="#">
<img src="ball2.jpg" title="this is the caption2" alt="alt text here" />
</a>
<a rel="fancybox" href="#">
<img src="ball3.jpg" title="this is the caption 3" alt="alt text here" />
</a>
我已经试过,但它不工作: JQuery的:
$("a[rel=fancybox]").fancybox({
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'titlePosition': 'inside',
'titleFormat': function (title, currentArray, currentIndex, currentOpts) {
title = $(this).find("img").attr("title");
return '<span>' + title + '</span>';
}
});
什么版本的fancybox的API选项
onStart
的title
属性?因为您正在使用v1.3.2 +和v2.x的选项,这些选项彼此不兼容。 – JFK 2012-07-19 06:54:47jquery.fancybox-1.3.4.js – ShaneKm 2012-07-19 06:58:34