Is it possible to set a fluid width for Facebook's social plugins?

后端 未结 29 1512
粉色の甜心
粉色の甜心 2020-12-22 18:52

I\'m developing a site around the \"responsive design\" concept, but the facebook social plugins are static width and \"break\" the layout when it\'s re-sized.

Using

29条回答
  •  我在风中等你
    2020-12-22 19:11

    If you are using the official wordpress facebook plugin due to the mobile sniffing facebook do.

    The mobile version will automatically show up when a mobile device user agent is detected. You can turn this behavior off by setting the mobile parameter to false. Please note: the mobile version ignores the width parameter, and instead has a fluid width of 100% in order to resize well in portrait/landscape switching situations. You may need to adjust your CSS for your mobile site to take advantage of this behavior. If preferred, you can still control the width via a container element. http://developers.facebook.com/docs/reference/plugins/comments/

    You will need to change the facebook/social-plugins/fb-comments.php on line 35.

    This will allow you to style with the below.

    .fb-social-plugin {
        width:98%!important;
    
    }
    
    .fb_iframe_widget span {
        width:100%!important;
    }
    
    .fb-comments iframe[style] {width: 100% !important;}
    

    It would be nice if they could either fix their mobile version or put a setting on their plugins GUI.

提交回复
热议问题