In the next few months we are looking to optimise the small library and extended. Feel free to join our discussion https://github.com/bovidiu/js-sharing-buttons/discussions and let us know your oppinion or just introduce yourself.
Social media buttons to share your page to social media;
The current library of social media list includes:
- Digg
- Tumblr
- VKontakte
- Delicious
- Gmail
- Blogger
- Amazon
- Bitly
#Install
You can use composer to install it composer require bovidiu/js-sharing-bootstrap
or npm npm i js-sharing-buttons
Or implement it manually by adding the script in the footer of the pagelike:
<script src="/path/to/js/SocialMedia.min.js"></script>
or use the CDN
<script src="https://cdn.jsdelivr.net/socialmedia.js/latest/SocialMedia.min.js"></script>
SRI CDN
<script src="https://cdn.jsdelivr.net/socialmedia.js/latest/SocialMedia.min.js" integrity="sha256-aq2Jk+ughOTxmvjt+RG7mStscd7Cpr/ifg2rkkc6z7E=" crossorigin="anonymous"></script>
#Configure
After adding the above script, right after add:
<script>
var sm = new SocialMedia();
sm.init();
</script>
It shoould look like similar to this:
<script src="https://cdn.jsdelivr.net/socialmedia.js/1.0/SocialMedia.min.js"></script>
<script>
var sm = new SocialMedia();
sm.init();
</script>
Add any where in the page a div or any HTML element with a class called socialMedia
, ie:
<div class="socialMedia"></div>
The library supports multiple instances in a page as well as custom configurations.
When the library get initialize include a defaultTarget
class.
<script>
var sm = new SocialMedia({
defaultTarget: 'myElementClassTarget'
});
sm.init();
</script>
By default the library will show Facebook and Twitter links, however you can enable/disable all icons. Example:
<script>
var sm = new SocialMedia({
icon: {
linkedin: {
active : true
}
}
});
sm.init();
</script>
<script>
var sm = new SocialMedia({
icon: {
facebook: {
active : false
}
}
});
sm.init();
</script>