Ads

Wednesday 26 November 2014

Socialight - Get Social Network Share Counts



This Jquery Plugin Socialight  is a javascript library to get Social Network Share Counts with Vanilla JS.
Browser support
IE8+ and modern browsers.
1. INCLUDE JS FILE
<script src="../build/socialight.min.js"></script>
2. HTML
<div class="social" data-url="http://www.pinceladasdaweb.com.br/"></div>
3. JAVASCRIPT
(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));

No comments:

Post a Comment