简体   繁体   English

像facebook这样的按钮不适用于fancybox

[英]button like facebook dosen't work with fancybox

I've a photo gallery with fancybox, when fancybox is open outside the tittle appears a like button. 我有一个带有fancybox的相册,当fancybox在外部打开时,标题出现类似按钮。 The problem is that doesn't work. 问题是那行不通。

here my JS: 这是我的JS:

 $(".fancyboxi").fancybox({
     padding: 0,
                openEffect  : 'none',
                closeEffect : 'none',

                prevEffect : 'none',
                nextEffect : 'none',

                closeBtn  : true,
            helpers: {


                overlay: {

                       css: {'background-color': '#333'} 
                    },
                title : {
                    type: 'outside'
                }
            },

          beforeShow: function () {
            if (this.title) {
                var titulo=this.href;

                // Add tweet button
  this.title += '<a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-url="http://kingpollo.it/'+ titulo + '">Tweet</a>';

            // Add FaceBook like button
                this.title += '<iframe src="//www.facebook.com/plugins/like.php?href=http://kingpollo.it/'+ titulo + '&amp;layout=button_count&amp;show_faces=true&amp;width=500&amp;action=like&amp;font&amp;colorscheme=light&amp;height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:110px; height:23px;" allowTransparency="true"></iframe>';


            }
        },

        afterShow: function(){
             twttr.widgets.load();
        },
        nextEffect: 'fade',
        prevEffect: 'fade'

    }); // fancybox});

The twitter button works correctly. Twitter按钮正常工作。 Why fb button no? 为什么没有fb按钮?

// Add FaceBook like button
this.title += '<iframe src="//www.facebook.com/

That part of the code is missing the correct fb url. 该部分代码缺少正确的fb url。

// Add FaceBook like button
this.title += '<iframe src="http://www.facebook.com/

Put the full url for the facebook button: 将完整的URL放入facebook按钮:

<a title="1st title" class="fancybox" href="/images/pic1_full.jpg">
<img alt="Photo number 1" src="images/pic1.jpg"

doesn't work but: 不起作用,但是:

<a title="1st title" class="fancybox" href="http://www.yousite.com/images/pic1_full.jpg">
<img alt="Photo number 1" src="images/pic1.jpg"

Works 作品

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM