Giter VIP home page Giter VIP logo

facebook-comment-resizer's Introduction

Facebook Comment Resizer

Facebook's comment widget has to be set to a fixed width and that sucks when working with responsive websites. This Mootools Class, once initialized, will re-size the comment boxes to the width of their containers and automatically re-size them if the window is re-sized.

Dependencies

Mootools Core (I'm using 1.4.5, but I imagine anything above 1.2 will work)

Options

margin (default - 10): Subtracts this value (x2) from the width of the comment box, to make it fit nicely into the container.

How to Use

Include the script in your page.

<script src="js/fb-comment-resizer.js"></script>

If you already have FB integration on your website, you may already have FB init function defined, it looks something like:

window.fbAsyncInit = function() {
  FB.init({
    appId      : 'YOUR_APP_ID', // App ID
    channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File
    status     : true, // check login status
    cookie     : true, // enable cookies to allow the server to access the session
    xfbml      : true  // parse XFBML
  });

  // Additional initialization code here
};

If so, initialize FacebookCommentResizer at the end of that function.

window.fbAsyncInit = function() {
  FB.init({
    appId      : 'YOUR_APP_ID', // App ID
    channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File
    status     : true, // check login status
    cookie     : true, // enable cookies to allow the server to access the session
    xfbml      : true  // parse XFBML
  });

  new FacebookCommentResizer({ margin : 10});
};

If you can't find anything like the above code on your page, add a simpler version (most of that is not needed for only comments):

window.fbAsyncInit = function() {
  new FacebookCommentResizer({ margin : 10});
};

facebook-comment-resizer's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.