Skip to content

Instantly share code, notes, and snippets.

@jimmynotjim
Created April 25, 2012 17:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jimmynotjim/2491531 to your computer and use it in GitHub Desktop.
Save jimmynotjim/2491531 to your computer and use it in GitHub Desktop.
Adaptive sizing for FB comments plugin
<!-- New HTML5 FB Comments -->
<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-comments" data-href="<?php the_permalink(); ?>" data-num-posts="4" data-width="320px"></div>
// Styles to force FB Comments to span the width of it's container //
.fb-like-box, .fb-like-box span, .fb-like-box.fb_iframe_widget span iframe,
.fb-comments, .fb-comments span, .fb-comments.fb_iframe_widget span iframe {
width: 100% !important;
}
@germanny
Copy link

Added FB Like Box classes if you're interested: https://gist.github.com/2778984

@jimmynotjim
Copy link
Author

@germanny Added to my Gist, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment