How to make facebook comment box width 100%?

前端 未结 9 563
逝去的感伤
逝去的感伤 2021-01-18 00:27

i am using this code to put a facebook comment box to my page,



        
9条回答
  •  广开言路
    2021-01-18 01:07

    Try adding the parameter data-width="{pixels}", as you’re getting when you get the code created on this page, https://developers.facebook.com/docs/reference/plugins/comments/ – that is, if you know the width of the page in pixels. I don’t know, if it works with percentages as well, but somehow doubt it.

    Then your last option might be to add resp. modify that parameter dynamically once your page has loaded and you can read out the actuall width in pixels, and have XFBML only parsed afterwards (setting xfbml param to false while loading the script, and calling FB.XFBML.parse after setting the data-width parameter). Of course, that still won’t help you, if the width get’s modified later by the user resizing the browser window or else …

提交回复
热议问题