Minimal jQuery Social Sharing Plugin - BEShare

Minimal jQuery Social Sharing Plugin - BEShare
File Size: 87.6 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

BEShare is a jQuery plugin that provides a simple way to integrate social share links into your web page. Currently supports Facebook, Twitter, Google Plus and Linkedin.

How to use it:

1. Load the required stylesheet file in the head section of your document.

<link rel="stylesheet" href="./styles.css">

2. Load the jQuery BEShare plugin's script after jQuery library.

<script src="//code.jquery.com/jquery.min.js"></script>
<script src="jQuery-BEShare.min.js"></script>

3. Create a 'popup' social share widget that displays a popup window containing social share links when you click on a toggle element.

$('.popup').BEShare({

  // CSS class to custom the popup
  'class': 'popup-share'
  
});

4. Create inline social share links with social icons on your web page.

$('.inline-share').BEShare({
  'type': 'inline',
  'targets': ['Facebook', 'Twitter', 'LinkedIn', 'GPlus', 'Print', 'Email'],
  'onShare': function(targetName) {
    ga('send', 'event', 'Social', 'Click', 'Share', targetName);
  }
});

5. Default plugin options.

$('SELECTOR').BEShare({

  // popup or inline
  'type': 'popup',

  // 'Facebook', 'Twitter', 'LinkedIn', 
  // 'GPlus', 'Print', 'Email'
  'targets': ['Facebook', 'Twitter'],

  // addional CSS class
  'class': PLUGIN_NAME,

  // CSS prefix & suffix 
  'prefix': 'icon-',
  'suffix': '',

  // width / height of the social share window
  'width': '626',
  'height': '436',

  // for twitter
  'via': '',

  // callback
  'onShare': null,

  'altLink': null

});

Changelog:

2018-06-14

  • v0.1.1

2018-03-08

  • Add aria-label attributes

2016-05-13

  • Support using href as full share URL

2015-07-02

  • Support `@via` in shared Tweet

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