admin管理员组文章数量:1405362
I'm building a page that is aggregating other pages in a Wordpress site, and displaying snippets of information about them along with a 'Like' button. Right now I'm using the iFrame option.
What happens is when a user clicks on a video, it displays it in a Feature area with the video, some text, and a Like button. This HTML is generated from a template and created after a user clicks on a video to watch it. There isn't a page refresh.
If I use the HTML5 version of the Like button, it never gets rendered, which I'm guessing is because the Like div never exists when the Facebook init is called. I'd like to not use the iFrame version though, because it doesn't seem to let me allow people to ment on their like.
Is there a way to have Facebook re-scan for elements to render? I know that Twitter will allow you to do this by running twttr.widgets.load()
at any time to have it rescan for things to render.
I'm building a page that is aggregating other pages in a Wordpress site, and displaying snippets of information about them along with a 'Like' button. Right now I'm using the iFrame option.
What happens is when a user clicks on a video, it displays it in a Feature area with the video, some text, and a Like button. This HTML is generated from a template and created after a user clicks on a video to watch it. There isn't a page refresh.
If I use the HTML5 version of the Like button, it never gets rendered, which I'm guessing is because the Like div never exists when the Facebook init is called. I'd like to not use the iFrame version though, because it doesn't seem to let me allow people to ment on their like.
Is there a way to have Facebook re-scan for elements to render? I know that Twitter will allow you to do this by running twttr.widgets.load()
at any time to have it rescan for things to render.
1 Answer
Reset to default 9Just call this function after loading the dynamic site, i am pretty sure it´s what you need:
https://developers.facebook./docs/reference/javascript/FB.XFBML.parse/
本文标签: javascriptDynamically add Like Buttons to a pageStack Overflow
版权声明:本文标题:javascript - Dynamically add Like Buttons to a page - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744230635a2596314.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论