Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Socialight

Get Social Network Share Counts with Vanilla JS

Demo

View demo here.

How to use?

In HTML, set the element that will be displayed counters, an example can be seen below:

<div class="social" data-url="http://www.pinceladasdaweb.com.br/"></div>

Socialight is a Vanilla JS plugin with no dependancies. Include the socialight.min.js in the footer of your page and initialise it:

(function(window, document, undefined) {
    "use strict";

    function SocialightFacade ($element) {
        var socialight = new Socialight({
                container: $element,
                url: $element.getAttribute("data-url")
            });

        socialight.add(new Twitter());
        socialight.add(new Facebook());
        socialight.add(new GooglePlus());
        socialight.add(new LinkedIn());
        socialight.add(new Buffer());
        socialight.add(new Pinterest());

        socialight.draw();
    }

    var el = document.querySelectorAll(".social"), i, len;

    for (i = 0, len = el.length; i < len; i++) {
        SocialightFacade(el[i]);
    }

}(window, document));

The plus.php file is responsible for making the request to return the data from Google+.

Browser support

IE8+ and modern browsers.

License

Socialight is licensed under the MIT License.

About

Get Social Network Share Counts with Vanilla JS

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages