Facebook Comments PlugIn - Largura 100% com ajuste quando .resize()
Definir largura de 100% para o FaceBook comments PlugIn com "escuta" para a alteração da largura da window.
by Salustiano Silva
HTML
<div class="fb-comments" data-href="http://example.com/comments" data-numposts="5" data-colorscheme="light"></div>
<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>
CSS
html, body{
height:100%;
width:100%;
margin:0;
padding:0;
}
JavaScript
function fluidComments() {
var $myWrap = $('body');
width = $myWrap.width();
$('.fb-comments').attr("data-width", width);
if ($(".fb-comments > span > iframe").size()==1)
FB.XFBML.parse();
}
$(function() {
fluidComments();
});
var progresso;
window.onresize = function(){
clearTimeout(progresso);
progresso = setTimeout(fluidComments, 100);
};