Data Share
A simple way to share links. It just replaces your href
and taget
attributes.
It depends on jQuery.
Support
- <input checked="" disabled="" type="checkbox"> Facebook
data-share-facebook
- <input checked="" disabled="" type="checkbox"> Twitter
data-share-twitter
- <input checked="" disabled="" type="checkbox"> Google Plus
data-share-plus
- <input checked="" disabled="" type="checkbox"> Linkedin
data-share-linkedin
Installation
npm install data-share
Usage
In your JS file, just require it:
require('data-share')
Then, in your HTML, use the data-share-{media}
attribute.
<a href="#" data-share-facebook>Share on facebook</a>
Through this attribute you can also pass options in JSON:
<a href="#" data-share-linkedin='{"title": "Crazy title"}'>Share on Linkedin</a>
Defaults
var defaults = {
url: window.location.href,
target: '_blank',
title: '',
source: '',
summary: ''
}