限制HTML5 Facebook的评论框 [英] Limit size of HTML5 Facebook comment box

查看:136
本文介绍了限制HTML5 Facebook的评论框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图限制从下面生成的代码的Facebook注释的垂直高度,但我不知道如何限制注释框的垂直高度。 (宽度,数据宽度参数由facebook提供)。有没有人知道我该怎么做?

I'm trying to limit the vertical height of the Facebook comments from the code generated below but I don't know how to limit the vertical height of the comment box. (for width, the data-width parameter is provided by facebook). Does anyone know how I could do this?

<html>
<head></head>
<body>
<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";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-comments" data-href="example.com" data-num-posts="2" data-width="500">    </div>
</body>
</html>

谢谢!

推荐答案

不幸的是FB目前不允许使用IFRAME方法,只有HTML5和XFBML,所以我用来解决这个问题的解决方案是将标签与另外一个div进行包装,将overflow-y设置为滚动,如:

Unfortunately FB doesn't currently allow the IFRAME method, only the HTML5 and XFBML, so the solution I've used to get around this is to wrap the tag with another div with "overflow-y" set to scroll, like:

<div id="fb_comments">
    <fb:comments href="http://example.com/" num_posts="10" width="500"></fb:comments>
</div>

我的fb_comments样式是:

My styling for fb_comments is:

#fb_comments { height:400px; padding-bottom:20px; overflow-y: scroll; }

这篇关于限制HTML5 Facebook的评论框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆