以下の jsfiddle を使用して、fancybox のタイトルにソーシャル ボタンを追加しています。2つの問題があります
1) jsfiddle では動作しますが、href に "this.href" コードを使用すると、いいね ボタンが表示されません。
2) ツイートの共有ボタンを使用すると、自分の Web サイトのタイトルが共有されますが、jsfiddle ではタイトルと画像の URL が表示されます。代わりに IFRAME のタイトルと URL を表示することはできますか? (jsfiddle でわかるように、私の fancybox のタイプは iframe です)。
JSFIDDLE: http://jsfiddle.net/kmLWf/44/
$.fancybox.update();
$('.iframe').fancybox({
beforeShow: function () {if (this.title) {
// New line
this.title += '<br />';
// Add tweet button
this.title += '<a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-url="' + this.href + '">Tweet</a> ';
// Add FaceBook like button
this.title += '<iframe src="//www.facebook.com/plugins/like.php?href=' + this.href + '&layout=button_count&show_faces=true&width=500&action=like&font&colorscheme=light&height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:110px; height:23px;" allowTransparency="true"></iframe>';}},
afterShow: function() {
// Render tweet button
twttr.widgets.load();
},
href:this.href,
padding:0,
type:'iframe',
scrolling : "no",
prevEffect : 'fade',
nextEffect : 'fade',
preload:true,
autoSize : false,
autoCenter: true,
fitToView : false,
loop: false,
helpers : {
overlay : {
css : {
'background' : 'rgba(0, 0, 0, 0.7)',
'overflow-y': 'hidden'
},
}
}
});