corazza
corazza

Reputation: 32354

How to adjust the width of the Facebook comments plugin?

Basically, most of my page is contained in a centered table. Underneath that, I'd like to have a Facebook comments section, but I'd like it to be of the same width as the table itself (table with is 95%). As you know, the Facebook comments plugin takes a fixed width, in pixels, how do I avoid that (or overwrite it)?

Upvotes: 0

Views: 295

Answers (1)

DMCS
DMCS

Reputation: 31870

Use something like jQuery to programmatically insert the comments plugin into your DOM after the page has been rendered setting it's width to the width the browser has displayed the parent div. Then call FB.XFBML.parse() to get it to show.

function adjustWidth(obj) {
    var width = parseInt($(obj).width());
    $(obj).html('<fb:like href="blah" width="' + width  + '></fb:like>');
    FB.FBXML.parse(obj);     
}

Upvotes: 1

Related Questions