1

タイトルと画像番号を含むキャプション付きのファンシーボックスギャラリーがあります。例:Title 1/2

画像の右側に画像番号、左側にタイトルを表示したいのですが。したがって、img番号を別のスパンタグにラップする必要があります。どうすればよいですか?

これが既存のマークアップです。

<div class="fancybox-title fancybox-title-float-wrap">
   <span class="child">5 / 7 - Soitinrakentajat pajalla, 2012</span>
</div

しかし、それは次のようになります。

<div class="fancybox-title fancybox-title-float-wrap">
   <span class="child">Soitinrakentajat pajalla, 2012</span>
   <span class="text-right">5 / 7</span>
</div>

img番号は次のように生成されます。

$(".fancybox").fancybox({
        afterLoad : function() {this.title = (this.index + 1) + ' / ' + this.group.length + (this.title ? ' - ' + this.title : '');}
    });

どうすればよいですか?

ありがとうございました

4

1 に答える 1

2

あなたは次のようなことをすることができます:

$(".fancybox").fancybox({
    helpers: {
        title: {
            type: 'inside'
        }
    },
    beforeShow: function () {
        this.title = "<span class='mySpanLeft'>" + (this.title ? this.title : '') + "</span>" + "<span class='mySpanRight'>Image " + (this.index + 1) + ' / ' + this.group.length + "</span>";
    }
});

JSFIDDLEを参照してください

于 2013-01-31T17:50:47.757 に答える