Code Monkey home page Code Monkey logo

sharer.js's Introduction

Sharer.js

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.

Usage:

Grab the latest min version and add on your page

<script src="js/sharer.min.js"></script>

Adding share behaviour to a component

Simply add the sharer class and the attributes above:

  • data-url: URL you want to share
  • data-title: Title of the share message (twitter, whatsapp, email, only)
  • data-to: Email to (Email only)
  • data-subject: Email subject (Email only)

Examples:

Facebook / Gplus / Linkedin:

<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>

Twitter:

<button class="sharer" data-url="http://mywesomeurl.com" data-sharer="twitter" data-title="Please check my awesome URL!"></button>

WhatsApp

<button class="sharer" data-url="http://mywesomeurl.com" data-sharer="whatsapp" data-title="Please check my awesome URL!"></button>

Email

<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>

sharer.js's People

Contributors

ellisonleao avatar frop avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.