Sharer.js is a very tiny js lib (~1.6kb) to create custom social share components on DOM elements for your website. Sharer.js has no dependencies. Currently supporting Facebook, Twitter, Google Plus, Linkedin, WhatsApp and Email Message.
<script src="js/sharer.min.js"></script>
Simply add the sharer
class and the attributes above:
data-url
: URL you want to sharedata-title
: Title of the share message (twitter, whatsapp, email, only)data-to
: Email to (Email only)data-subject
: Email subject (Email only)
<button class="sharer" data-url="http://mywesomeurl.com" data-sharer="facebook"></button>
<button class="sharer" data-url="http://mywesomeurl.com" data-sharer="googleplus"></button>
<button class="sharer" data-url="http://mywesomeurl.com" data-sharer="linkedin"></button>
<button class="sharer" data-url="http://mywesomeurl.com" data-sharer="twitter" data-title="Please check my awesome URL!"></button>
<button class="sharer" data-url="http://mywesomeurl.com" data-sharer="whatsapp" data-title="Please check my awesome URL!"></button>
<button class="sharer"
data-url="http://mywesomeurl.com"
data-sharer="email"
data-title="Please check my awesome URL!"
data-to="[email protected]"
data-subject="Hey, check this out!"></button>