Skip to content

Share current page on Facebook, Twitter, Google+ and WhatsApp

Notifications You must be signed in to change notification settings

mogusbi/jquery.share

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jQuery Share plugin

Share current page on Facebook, Twitter, Google+ and WhatsApp

Getting started

NPM

Install package with NPM and add it to your dependencies: npm install @mogusbi/jquery.share --save

Introducing it to your page

Include jQuery and the plugin to your page. Ensure you have your canonical and/or short link meta tags present as they will be used to generate the share link. Add the data-share attributes to your button and call the share method.

<!doctype html>
<html>
  <head>
    <link href="http://mogusbi.co.uk" rel="canonical" />
    <link href="http://short.link" rel="shortlink" />
  </head>
  <body>
    <button type="button" data-share="facebook">Facebook</button>
    <button type="button" data-share="twitter">Twitter</button>
    <button type="button" data-share="google-plus">Google+</button>
    <button type="button" data-share="whatsapp">Whatsapp</button>

    <script src="jquery.js"></script>
    <script src="jquery.share.js"></script>
    <script>
      $('[data-share]').share();
    </script>
  </body>
</html>

License

Copyright © Mo Gusbi. Licensed under the MIT license.

About

Share current page on Facebook, Twitter, Google+ and WhatsApp

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published