Skip to content

Instantly share code, notes, and snippets.

@abnersajr
Last active April 7, 2016 19:25
Show Gist options
  • Save abnersajr/3b2b619d6f5ae0921e5f to your computer and use it in GitHub Desktop.
Save abnersajr/3b2b619d6f5ae0921e5f to your computer and use it in GitHub Desktop.
Responsive page plugin of facebook. Wrap on .fb-container and will get the width of the container when resize, then will reparse
/**
* Reparse with facebook container width to responsive width
* @param {string} link Facebook Page link
* @param {string} title Page title
* @return {mixed} Return facebook plugin with new size
*/
function facebookResize(link, title) {
var FB_TITLE = title';
var FB_LINK = link';
var $FB_CONTAINER = $('.fb-container');
$FB_CONTAINER.html('<h1 class="footer-title">Siga-nos no facebook</h1><div class="fb-page" data-href="'+FB_LINK+'" data-small-header="false" data-adapt-container-width="true" data-width="'+parseInt($FB_CONTAINER.width())+"px"+'" data-hide-cover="false" data-show-facepile="true"><div class="fb-xfbml-parse-ignore"><blockquote cite="'+FB_LINK +'"><a href="'+FB_LINK +'">LP Arquitetos</a></blockquote></div></div></div>');
FB.XFBML.parse();
}
$(window).on('resize',function(){
facebookResize('PAGE TITLE','https://www.facebook.com/pagelink/');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment