我在我的网站上为开发人员使用Facebook社交插件。它对移动设备和平板电脑没有响应能力我没有采用StackOverflow的答案,但仍然无法解决我的问题。我有一个内容行和一个span6类,其中放置了我的小部件。
我的HTML就是这样。
<div class="row content_row">
<div class="span6">
<div class="Facebook">
<h2><a id="about_us">Facebook</a></h2>
<div class="fb-page" data-href="https://www.facebook.com/pages/IFix-And-Repair/242100755854336" data-tabs="timeline" data-width="500" data-height="400px" data-small-header="false" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true"><div class="fb-xfbml-parse-ignore"><blockquote cite="https://www.facebook.com/pages/IFix-And-Repair/242100755854336"><a href="https://www.facebook.com/pages/IFix-And-Repair/242100755854336">iFixandRepair - Wellington</a></blockquote></div></div>
</div>
</div>
我确实从其他答案中应用了一些CSS但它也失败了。
的CSS:
.fb-page, .fb-page iframe[style], .fb-page span {
min-width: 100% !important;
width: 100% !important;
}
答案 0 :(得分:1)
<强>限制强>
使用CSS3转换
设置data-adapt-container-width =“false” (或在500px下出现问题)
此fb插件设置为500x500
<script src="jquery.rwd-fb-plugin.js"></script>
<!--FB-page-plugin part1-->
<div id="fb-root"></div> <script>(function(d, s, id) { ... } </script>
<!--FB-page-plugin part2-->
<div class="fb-page"> ... </div>
$(function(){
$('.fb-page').rwd();
});
答案 1 :(得分:0)
你需要用新的数据宽度和调用函数调用fb-page div&#34; FB.XFBML.parse();&#34;每次,网站何时调整大小。 所以JavaScript可以帮助解决这个问题:
<div class="row content_row">
<div class="span6">
<div class="Facebook">
<h2><a id="about_us">Facebook</a></h2>
<div class="facebook-wrap">
<div class="fb-page" data-href="https://www.facebook.com/pages/IFix-And-Repair/242100755854336" data-tabs="timeline" data-width="500" data-height="400px" data-small-header="false" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true"><div class="fb-xfbml-parse-ignore"><blockquote cite="https://www.facebook.com/pages/IFix-And-Repair/242100755854336"><a href="https://www.facebook.com/pages/IFix-And-Repair/242100755854336">iFixandRepair - Wellington</a></blockquote></div></div>
</div>
</div>
</div>
</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/sdk.js#xfbml=1&version=v2.2";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
$(function(){
$(window).resize(function(){
$('.facebook-wrap').html('<div class="fb-page" data-href="https://www.facebook.com/pages/IFix-And-Repair/242100755854336" data-width="'+$('.facebook-wrap).width()+'" data-height="400px" data-small-header="false" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true"><div class="fb-xfbml-parse-ignore"><blockquote cite="https://www.facebook.com/pages/IFix-And-Repair/242100755854336"><a href="https://www.facebook.com/pages/IFix-And-Repair/242100755854336">iFixandRepair - Wellington</a></blockquote></div></div>');
FB.XFBML.parse();
});
});
</script>