Get Social Network Share Counts with Vanilla JS
Socialight get Social Network Share Counts on demand. Specify the url and social networks to display counters, the rest is magic. Demo.
Twitter removed share counts, please, read here.
# Get the latest snapshot
$ git clone git@github.com:pinceladasdaweb/Socialight.git
In HTML, set the element that will be displayed counters, an example can be seen below:
<div data-socialight-url='YOUR-URL' data-socialight-title='YOUR-TITLE' data-socialight-text='YOUR-TEXT' data-socialight-image='YOUR-IMAGE' data-socialight-channels='["facebook", "twitter" "googleplus", "linkedin", "buffer", "pinterest"]'></div>
Socialight is a Vanilla JS plugin with no dependencies. Include the socialight.min.js
before your </body>
tag and initialise it:
<script src="path/to/socialight.min.js"></script>
<script>
new Socialight();
</script>
Loading Socialight via AMD (require.js):
<script>
require(["path/to/socialight.min.js"], function(Socialight) {
new Socialight();
});
</script>
The script expect the following attributes in the html tag:
Value | Description |
---|---|
data-socialight-url | The URL to share and get share counts |
data-socialight-title | The title to share |
data-socialight-text | The description link to share |
data-socialight-image | The image url to share |
data-socialight-channels | Social networks to display share counts |
Socialight support the following services: Facebook, Twitter, Google+, Linkedin, Pinterest and Buffer
##Browser Support
IE 9+ ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ |
Check CONTRIBUTING.md for more information.
Check Releases for detailed changelog.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。