Facebook like button not displaying in FancyBox?

北战南征 提交于 2019-12-09 23:27:27

问题


I have applied the Facebook like button on a page where I am displaying all the post from my WordPress admin. I applied the Facebook like button code, and it is working fine here, but when user clicks on the post, that post is getting open in FancyBox where I am applying the Facebook like button, but the Facebook like button is not getting created there. How can I do this?

This is the code I am using to create the Facebook like button at both places:

<div id="fb-root"></div>
<script>
    (function(d, s, id) {
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id))
            return;
        js = d.createElement(s);
        js.id = id;
        js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=145332828885141";
        fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));
</script>

<div class="fb-like"
     data-href="https://www.facebook.com/pages/PHPsyms/130379690383205"
     data-send="false"
     data-layout="button_count"
     data-width="450"
     data-show-faces="false"></div>

回答1:


It will work in FancyBox:

<iframe
    src="http://www.facebook.com/plugins/like.php?href=URL_HERE%2F&amp;layout=button_count&amp;show-faces=false&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light"
    scrolling="no"
    frameborder="0"
    allowTransparency="true"
    style="border:none;
    overflow:hidden;
    width:110px;
    height:px">
</iframe>


来源:https://stackoverflow.com/questions/10250402/facebook-like-button-not-displaying-in-fancybox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!