-
Notifications
You must be signed in to change notification settings - Fork 15
3. JavaScript API
Adam Chambers edited this page Jun 2, 2016
·
14 revisions
You can also initialize OpenShare nodes in JavaScript for more fine-grained control over node generation.
You can use the last word from all data attributes in the data attributes API as options in the JS API as well as a few extras:
new OpenShare.share({
type: 'twitter',
bindClick: true,
innerHTML: 'Check it out!'
}, document.querySelector('[data-my-element]');| Property | Value |
|---|---|
type |
Name of the service. e.g. 'Twitter', 'Facebook', 'Github', etc.. |
bindClick |
Boolean. Set true to allow Share Node to share when clicked. |
appendTo |
Element to append the Share Node to. |
innerHTML |
Sets a string as innerHtml to the Share Node. |
element |
Element to create the share node as rather than appending to element arg |
classes |
An array of classes to be added to the Share Node. |
You can also generate count nodes using the JavaScript API:
new OpenShare.count({
type: 'facebook',
url: 'http://www.digitalsurgeons.com'
}, document.querySelector('[data-my-element]');| Property | Value |
|---|---|
type |
The service to get a count from. |
url |
URL to get a count from. |
element |
Element to create a count node of. (Default: <span>) |
classes |
Array of classes to give the count node. |
appendTo |
Element to append the count node to. |