Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook like box widget not recognizing data-width attribute?

I just noticed today that the data-width attribute for the Facebook Like Box widget does not appear to be working. It looks like it is reverting to the default width. An example of what I'm talking about can be seen on http://blog.christopherjonesart.com.

Here is the code I'm using (it's pretty standard):

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) {return;}
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div class="fb-like-box" data-href="http://www.facebook.com/christopherjonescomicart"    data-width="190" height="395" data-show-faces="true" data-border-color="black" data-stream="false" data-header="true"></div>

I am experiencing this issue on several websites. It is doing it in Chrome, Firefox, Safari and Internet Explorer. I have not recently updated Wordpress or made any changes to my css.

Help? It looks really crummy like this. :-(

like image 343
tlhInganHom Avatar asked Jun 12 '13 02:06

tlhInganHom


People also ask

How do I add a Facebook Like Box?

Go to Facebook Social Plugin's Like Box page. Provide the URL of your Facebook page and configure the looks of the like box. Press the Get Code button to get Like box code. Facebook provides you multiple ways to add the like box code on your website.

How do I embed Facebook into WordPress?

Simply drag the Facebook Page Plugin widget into your desired widget area, and then paste the URL of your Facebook page into the `Page URL` field. If you are using the classic widget editor, click Save and view your site to see the Facebook page embedded in your widget area.


4 Answers

Expanding on user2477225's answer, it might have problems with custom positioning that you set (relative or absolute somewhere on the page), so what I did was:

.fb_iframe_widget>span { width: 240px !important; }
.fb-like-box iframe { width: 240px !important; }

Seems to be working so far.

Edit: For IE 8 (and lower), please use this instead:

.fb_iframe_widget span { width: 240px !important; }
.fb-like-box iframe { width: 240px !important; }

I like to be as specific as possible in my selectors, but after checking this issue some more, I see no technical reason to use the > selector here.

like image 77
Ynhockey Avatar answered Sep 19 '22 15:09

Ynhockey


i think we should tell fb to fix their dumb script, now fb like box must be at least 292 px in width.

They state clearly on https://developers.facebook.com/docs/reference/plugins/like-box/

The minimum supported plugin width is 292 pixels.

like image 39
nam vo Avatar answered Sep 18 '22 15:09

nam vo


I fixed the width with a little CSS hack but it is only temporary. My hack is this:

.fb-like-box iframe {
     width: your_width_in_px !important;
}
like image 23
user2477225 Avatar answered Sep 20 '22 15:09

user2477225


Use the iframe settings, in my site using the iframe settings with a likebox of 236px width and it overrules the 292px width. Brainless thinking of FB, every site needs a sidebar of 292px width???? yeye

like image 38
Ronald de Block Avatar answered Sep 20 '22 15:09

Ronald de Block