Responsive Facebook Comments CSS Hack Broken

后端 未结 17 1744
渐次进展
渐次进展 2020-12-12 22:48

I was using:

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

To make Facebook Comments responsi

17条回答
  •  感情败类
    2020-12-12 23:30

    I got bit by this too. I put in a JS hack. Basically bind to the resize event of the window and redraw the comments widget when it fires (uses jquery if you want I can post without):

    $(window).resize(function(){
     $(".fb-comments").attr("data-width", $(".comments").width());
     FB.XFBML.parse($(".comments")[0]);
    });
    

    In the example above .comments is the container that you want the width of the fb-comments to expand to. The downside of this is that when the window is resized the comments widget is reinitialized.

    If you use underscore wrap the resize handler using debounce to keep it from firing to often.

提交回复
热议问题