Responsive Facebook Comments CSS Hack Broken

后端 未结 17 1741
渐次进展
渐次进展 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:13

    Hope this helps:

    /* resize facebook comments */
    (function(window){
        var dh = null;
        $(window).on("resize",function(){
            if ( dh ) {
                clearTimeout(dh);
            }
            dh = setTimeout(function(){
                var $fbc = $(".fb-comments");
                var $stc = $(".comments-container");
                dh = null;
                if ( $fbc.attr("data-width") != $stc.width() ) {
                    $stc.css({height:$stc.height()});
                    $fbc.attr("data-width", $stc.width());
                    FB.XFBML.parse($stc[0],function(){
                        $stc.css({height:'auto'});
                    });
                }
            },300);
        }).trigger("resize");
    })(this);
    

    Cheers!

提交回复
热议问题