Giter Site home page Giter Site logo

kanfet / goodshare.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from koddr/goodshare.js

0.0 1.0 0.0 1.1 MB

🚀 Useful modern JavaScript solution for share a link from your website to social networks or mobile messengers. Easy to install and configuring on any of your website!

Home Page: https://koddr.github.io/goodshare.js/

License: MIT License

HTML 6.92% JavaScript 93.08%

goodshare.js's Introduction

goodshare-js-logo-github

goodshare.js

npm version jsDelivr download js es6 license

Useful jQuery plugin modern JavaScript solution for share a link from your website to social networks or mobile messengers. Easy to install and configuring on any of your website!

Features

Simple install, extensive documentation, developer support, SEO friendly, many options for customization of appearance, clean code without scripts tracking user activity on the page, high speed.

Full Documentation & Demos

Installation

Install via npm:

$ npm install goodshare.js --save

Or include from jsDelivr CDN:

<script src="https://cdn.jsdelivr.net/npm/goodshare.js@4/goodshare.min.js"></script>

Usage

Script works with any HTML tags: <a> or <div> or <button> or other.

So you can choose any and add required attributes data-social.

For example:

<!-- Create button with share to Twitter -->
<button data-social="twitter">Share this to Twitter</button>

<!-- Create link with share to Facebook -->
<a href="#" data-social="facebook">Share this to Facebook</a>

<!-- Create div container with share to LinkedIn -->
<div data-social="linkedin">Share this to LinkedIn</div>

<!-- Create icon from Fontello.com with share to Google+ -->
<i class="icon-google-plus" data-social="googleplus"></i>

By default, goodshare.js search this tags for get title, description and image (for some social networks):

<head>
  <title>Current page title</title>
  <meta name="description" content="Current page description.">
  <link rel="apple-touch-icon" href="http://example.com/path/to/image.png">
  ...
</head>

If you want to add different url, title, description and image to share element — use special data-* attributes:

  • data-url redefines document.location.href
  • data-title redefines document.title
  • data-description redefines meta[name="description"]
  • data-image redefines link[rel="apple-touch-icon"]

Note: Please keep in mind, not all social networks support all of them data attributes!

To display share count, just add data-counter attribute to HTML element that will contain numbers. For example:

<!-- Create link with share to Facebook and counter -->
<a href="#" data-social="facebook">
  Share this to Facebook
  <span data-counter="facebook"></span>
</a>

You also may put this attribute to any element.

Notes

  • No more depending on jQuery! Since 4.x, no longer support the old goodshare.js version (3.2.9 and lower). Thank you jQuery, but ES6 is better and cleaner.
  • Browser support. Since 4.x, goodshare.js do not support Internet Explorer 10 and older (check ES6 support table).

Author & maintainers

Development and maintenance engaged by Vic Shóstak (aka Koddr). If you want to say «thank you» and/or ask me about goodshare.jscreate new issue.


Your assistance will help make project even better!

Thanks for supporting!


License

The MIT License (MIT)

goodshare.js's People

Contributors

koddr avatar lukasdrgon avatar moimikey avatar kanfet avatar mschilder avatar x35a avatar

Watchers

James Cloos 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.