http://developers.facebook.com/docs/reference/plugins/comments/
这是我在页面上包含Facebook javascript SDK后生成评论区域的方式:
<div class="fb-comments fb-comments-update" data-href="http://site.com" data-width="600" data-colorscheme="light" data-num-posts="10" data-order-by="social" data-mobile="auto-detect"></div>
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,facebook会根据您提供的数据属性设置注释区域的宽度:
data-width="600"
Run Code Online (Sandbox Code Playgroud)
在这种情况下,我告诉Facebook我希望该区域为600像素.但我现在正在构建一个响应式网站,需要评论部分才能使屏幕的宽度达到100%.不做这些工作:
data-width="100"
data-width="100%"
Run Code Online (Sandbox Code Playgroud)
有什么办法可以获得Facebook评论的流畅宽度吗?
小智 5
试试这段代码:
<style>.fb-comments, .fb-comments iframe[style], .fb-like-box, .fb-like-box iframe[style] {width: 100% !important;}
.fb-comments span, .fb-comments iframe span[style], .fb-like-box span, .fb-like-box iframe span[style] {width: 100% !important;}
</style>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3634 次 |
| 最近记录: |