<img>
タグの代わりにタグからキャプションを取得する方法はあり<a>
ますか?
たとえば、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>';
}
});