I am using the jsfiddle below to add social buttons on my fancybox title. I have two issues
1) The like button doesn't appear, when using "this.href" code for the href, although it works on the jsfiddle.
2) When I use the tweet share button, it shares the title of my website, although on the jsfiddle it displays the title + the image url. Is it possible to display the IFRAME title & url instead?(as you can see on jsfiddle my fancybox type is 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'
},
}
}
});
Adding absolute URL's on my image href's fixed the issue.