Skip to content

Instantly share code, notes, and snippets.

@germanny
Forked from jimmynotjim/fb-comments.html
Created May 24, 2012 01:47
Show Gist options
  • Save germanny/2778984 to your computer and use it in GitHub Desktop.
Save germanny/2778984 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;
}
@jimmynotjim
Copy link

Awesome, I wish there was a way to merge your version into mine. Guess I'll have to rely on good ole copy'n'paste.

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