Simple jQuery Plugin For Custom Social Share Buttons - SocialJS

File Size: 510 KB
Views Total: 2317
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
Simple jQuery Plugin For Custom Social Share Buttons - SocialJS

SocialJS is a simple lightweight jQuery plugin to generate custom social buttons with share counts for sharing your webpage over 5 major social networking sites: Twitter, Facebook, Linkedin, Google Plus, and Reddit.

How to use it:

1. Load the stylesheet socialjs.css in the head section for default social button styles.

<link href="dist/socialjs.css" rel="stylesheet">

2. Load the Font Awesome  for social media icons (OPTIONAL).

<link rel="stylesheet" href="font-awesome.min.css">

3. Create a list of social share buttons and use data- attribute to setup the sharing options.

  • data-sharetype: twitter, facebook, linkedin, googleplus, reddit
  • data-basecount: Base count
  • data-text: If not specified the plugin will take the title of the page as text.
  • data-via: For Twitter
  • data-related: For Twitter
<div class="socialjs">
      <a class="sharebutton facebook" 
         data-text="Text to share" 
         title="Title to share" 
         <i class=" fa fa-facebook"></i> 
         <span class="count"></span>

4. Call the plugin on the top element.


5. Available options and callback functions. Options can be overwritten when initializing plugin, by passing an object literal, or after initialization.

// $('#el').socialjs({OPTIONS});
// OR $('#el').socialjs('option', 'key', value);

// Container
container: '.socialjs',

// Uses https instead of http
https: true,

// urls to get counts
urls: {
  GooglePlus: 'backend/GooglePlusCall.php',
  Facebook: '',
  Linkedin: '',
  Reddit: ''

// Show total by k or M when number is to big.
shortCount: true,

// Fetch share count
fetchCounts: true,

// Callback functions.
onInit: function () {},
onLoad: function () {},
onDestroy: function () {},
onClick: function(){},

6. Public methods.

// destroy the plugin

// Get total count

// Get Facebook count

// Get Google Plus count

// Get Twitter count

// Get Reddit count

// Get LinkedIn count



  • v2.2.0

This awesome jQuery plugin is developed by SubZane. For more Advanced Usages, please check the demo page or visit the official website.