Social Counter: JQuery Plugin To Get Twitter, Facebook And Feed Readers Count

Appending my previous post, I have created a plugin in JQuery to get twitter followers count, facebook likes and feed readers count. In my previous post, I have shown a way to get the counts in ASP.NET and I have created this plugin so that everyone can use and show counts on their blogs or site.

To get started add the two javascript files, one is the jquery file and the other one is the plugin file.



Before I proceed to show you how to get it done, I should explain a bit about my small plugin. This plugin accepts 2 parameters:

  • SocialSite: Name of the social site like Twitter, Facebook and Feeds (case-sensitive).
  • UName: This options holds the user name or the facebook URL or the feed reader URL or the user name.

Now it’s all on the developer/designer where he wants to show the counter. I have set 3 divs on my page with ID. It is not at all necessary to use divs, you can use whatever you want. To get the counts I will do the following on the document.ready function.

$(document).ready(function () {
       $("#tweet").SocialCounter({ SocialSite: 'Twitter', UName: 'prashantmx' });
       $("#FBLikes").SocialCounter({ SocialSite: 'Facebook', UName: 'http://facebook.com/audi' });
       $("#FeedReader").SocialCounter({ SocialSite: 'Feeds', UName: 'Midnightprogrammer' });
});

Download: jquery.SocialCounter.zip (889.00 bytes)

comments powered by Disqus