jQuery Facebook Like Plugin

The Facebook Like button has become very popular with the recent release of the Open Graph API. This plugin allows you to add the Facebook Like button to any website and use all of the options associated with the Facebook Like API and JavaScript SDK.

Features:

  • Can add meta data to your pages to be included on Facebook
  • If already logged in, will allow you post favorites to site – if not logged in, will prompt you to log in.
  • Works with all FB Like options

Demonstration:

  • Facebook Like Demo
  • Or just look at the top of this post, you will see a Like Button – which is being added by this plugin.

Requirements:

  1. jQuery – Compatible up to 1.4.1
  2. Facebook Application ID – Get one here.
  3. Its important that you put the plugin and function at the bottom of your page.

Download:

How it Works:

Once the script has been setup on the page, it will automagically pull in the page URL and page Title – and allow you to like on on facebook. If your friends also like it, you will see their names/faces show up. If you are not logged in, you will only see the number of people who like it and if you click “like” – it will prompt you to login.

Code Example:

<script type="text/javascript" src="../js/jquery.onefblikev1.0.js"></script>
<div id="fb-like-example"></div>
$(document).ready(function () {
    	$('#fb-like-example').oneFBLike({appID:'XXXXXXXXXXXXXXX'});
	});

Options:

The following options can be passed into the plugin and if they are not, the default values below will be shown:

appID: 'XXXXXXXXXXXXXXX',  // This is mandatory, if you dont enter a Facebook Application ID - the plugin will not work
siteTitle: ' ', // Optional Meta
siteName: ' ', // Optional Meta
siteImage: ' ',
buttonWidth: 450,
buttonHeight: 80,
showfaces: true,
font: 'lucida grande',
layout: 'normal',
action: 'like',
colorscheme: 'light'

Useful Resources:

6 Responses to “jQuery Facebook Like Plugin”

6 Comments so far
  1. Got to implement this one very soon :) I do not like that iframe stuff

  2. Yes, I didnt like the iframe option either – their JavaScript SDK is actually very slick!

  3. Implementing it! I like that one, good work and thanks for sharing :-)

  4. I had implemented this in the right section of my webpage, but content of the meta tags is not loaded(If I like my page then on Facebook will appear the same info that exists in Linter, not the one that I changed using customized OpenGraph tags)…. Please help me.

  5. Can you post your code? Thanks.

  6. Sick!

    Thanks a lot for this!

    Just a question if possible:

    Is it possible to change the language? It’s in English right now, but I’m planning to make a multilingual website, that’s why I’m curious. :)

    Thanks again for the great script!




XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

By submitting a comment here you grant Jake Rutter – Front-End Developer and Designer, CSS, JavaScript and jQuery, PHP, Wordpress, Expression Engine, Magento a perpetual license to reproduce your words and name/web site in attribution. Inappropriate comments will be removed at admin's discretion.