我可以去 facebook 并获取“like box”的代码。非常便利。
问题是,这个盒子的显示很蹩脚。这是不一致的。“流”中的第一篇文章以这种缩进显示:
流中的下一篇文章以不同的(蹩脚的)缩进显示。
这是在同一个likebox中,我只是向下滚动。
效果不限于“Facebook 平台”的流。我也在其他流的 Likebox 中看到了它。
我想对盒子进行样式设置,以尝试使缩进保持一致,但它似乎被呈现为 iframe,这(我认为)意味着由于 SOP 我无法设置它的样式
我怎样才能解决这个问题?
是否有一种解决方法可以在最终不是 iframe 的 div 中显示类似框?
编辑:错误记录:http: //developers.facebook.com/bugs/237053466346453
编辑:我比较了fb:fan
控件和likebox控件。有了这个fb:fan
东西,就可以提供自定义 CSS 来设置内容的样式。(有一些警告。)我设置了文本的宽度和边距,还删除了actorName
,这对于每个帖子都是一样的。这是结果:
左侧是使用以下代码生成的:
<fb:fan profile_id='19292868552' width='292'
connections='0' show_faces='false' stream='true' header='false'
css='http://example.org/fb/customfanbox.css?_=6392'></fb:fan>
右侧是这样产生的:
<iframe src="//www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fplatform&width=292&colorscheme=light&show_faces=false&border_color&stream=true&header=false&height=525"
scrolling="no"
frameborder="0"
style="border:none; overflow:hidden; width:292px; height:525px;"
allowTransparency="true">
对于左侧,如果您不想要该fb:fan
元素,可以使用指向 fan.php 的 iframe,如下所示:
<iframe src='http://www.facebook.com/plugins/fan.php?connections=0&css=http%3A%2F%2Fexample.org%2Ffb%2Ffb%2Fcustomfanbox.css%3F_%3D0292&id=19292868552&locale=en_US&sdk=joey&stream=true&width=292&height=560'
scrolling="no"
frameborder="0"
style="border-bottom:1px grey solid; overflow:hidden; width:292px; height:525px;"
allowTransparency="true">