Coder Social home page Coder Social logo

elizad / js-sharing-buttons Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bovidiu/js-sharing-buttons

0.0 0.0 0.0 288 KB

Inject Social Media FontAwesome Icons and makes button shareable.

License: MIT License

JavaScript 41.22% Shell 1.06% TypeScript 57.73%

js-sharing-buttons's Introduction

Build Status #Social Media Sharing Buttons Social media buttons to share your page to social media;

The current library of social media list includes:

  • Facebook
  • Twitter
  • LinkedIn
  • Pinterest
  • Google
  • Digg
  • Tumblr
  • Reddit
  • 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

Script

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>

HTML

Add any where in the page a div or any HTML element with a class called socialMedia, ie:

<div class="socialMedia"></div>

Custom settings

The library supports multiple instances in a page as well as custom configurations.

Change target element class

When the library get initialize include a defaultTarget class.

<script>
var sm = new SocialMedia({
  defaultTarget: 'myElementClassTarget'
});
sm.init();
</script>

Activate/Deactivate buttons

By default the library will show Facebook and Twitter links, however you can enable/disable all icons. Example:

Activate LinkedIn button

<script>
var sm = new SocialMedia({
  icon: {
    linkedin: {
      active : true
    }
  }
});
sm.init();
</script>

Deactivate Facebook button

<script>
var sm = new SocialMedia({
  icon: {
    facebook: {
      active : false
    }
  }
});
sm.init();
</script>

js-sharing-buttons's People

Contributors

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