Flexible And Easy Social Sharing Plugin For jQuery - customShareCounts

File Size: 7.23 KB
Views Total: 1692
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Flexible And Easy Social Sharing Plugin For jQuery - customShareCounts

customShareCounts is a simple, flexible jQuery social sharing plugin which generates social links with total share counts to share your posts (or any URLs) on popular social networks: Facebook, Twitter, Google Plus and Linkedin.

How to use it:

1. Put jQuery library and the jQuery customShareCounts.js plugin at the bottom of your html page.

<script src="//code.jquery.com/jquery.min.js"></script>
<script src="customShareCounts.min.js"></script>

2. Define the social share information for your post using HTML5 data attributes as follows:

<div class="share-items" 
     data-title="Custom Share Links" 
     data-hash="Custom Share Links" 
     data-url="URL To Share">
     Post Content Goes Here
     <a class="share-url" href="URL To Share">Read More...</a>
</div>

3. Add a list of social share links to the post.

<ul class="share-links">
  <li>
    <a class="twitterBtn" data-dir="left" href="" >
      <span>Twitter</span>
      <span class="twitter-count"></span>
    </a>
  </li>
  <li>
    <a class="facebookBtn" href="">
      <span>Facebook</span>
      <span class="facebook-count"></span>
      </a>
  </li>
  <li>
    <a class="linkedinBtn" href="">
      <span>LinkedIn</span>
      <span class="linkedin-count"></span>
      </a>
  </li>
  <li>
    <a class="googleBtn" href="">
      <span>Google</span>
      <span class="google-count"></span>
      </a>
  </li>
  <li>
  <span>Total</span>
  <span class="total-count"></span>
  </li>
</ul>

4. Initialize the plugin and specify the social networks you want to enable. It Twitter is enabled, you have to sign up for a free Opensharecount account in order to get the Twitter share counts & totals

$('.share-items').customShareCount({
  twitter: true,
  facebook: true,
  linkedin: true,
  google: true,
});

5. More configuration options.

$('.share-items').customShareCount({

  twitter: true,
  facebook: true,
  linkedin: true,
  google: true,

  // Your Twitter username
  twitterUsername: '',

  // Shows the counts on buttons
  showCounts: false,

  // Shows the total of all the shares
  showTotal: true

});

Change log:

2016-05-18

  • fixed bug where total counts were not displaying if show counts was false

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