2

这是一个奇怪的。我的一个页面上有 HTML5 Facebook 评论,页面加载后,Facebook 评论区域开始水平缩小,直到达到 5 或 0px。在这里你可以看到它:

http://www.rocketcases.com/casestarter/captain-quinn

我无法弄清楚为什么这已经开始发生了。它不是这样开始的,它最近才开始这样做。

我已经尝试禁用所有其他 JS,但它仍在发生。我搜索了谷歌和 StackOverflow。似乎没有其他人遇到过这种情况。

有任何想法吗?我错过了一些非常明显的东西吗?

4

3 回答 3

1

Set the span's width which is inside the fb-comments fb_iframe_widget container to 100% !important.

Like this:

.fb_iframe_widget span { width: 100% !important}

EDIT:

The reason appears to be in one of Facebook's scripts, which calculates the width of the element relative to the parent element. A piece from the script:

s.height=Math.max(this._shrinker.offsetTop,0)

What this means is, unless the parent element (in your case, the div with the classes fb-comments and fb_iframe_widget) has a fixed width, the script will loop and keep on reducing the width.

Here's the snippet from the script if you're interested: http://pastebin.com/GesPgQNY

于 2013-11-14T06:36:27.690 回答
0

Setting a min-width for the element will solve the problem. and it is better to assign a unique class to plugin's parent element, to avoid future conflicts.

.fb-comments.fb_iframe_widget span:first-child {
min-width: 600px;
}
于 2013-11-14T06:36:36.423 回答
0

这是因为我添加了一些自定义 CSS 来调整 FB 评论 div 的宽度。

.fb-comments, .fb-comments iframe[style] {width: 90% !important;

一旦我删除它,它就可以正常工作。太奇怪了。

谢谢您的帮助!

于 2013-11-14T16:06:49.013 回答