JSFiddle - React, Tailwind, and code Playground

by icodeforlove

HTML

<a href="#">click me</a>

JavaScript

$('head').append($('<style>.pls-container {display: none;}</style>'));

var script = document.createElement('script');
script.innerHTML = '{parsetags: \'explicit\'}';

script.addEventListener('load', function () {


    var plusone = $('<div style="opacity: 0; position: absolute; color: #000">');
    
    // add plusone to body
    $(document.body).append(plusone);
    
    // plusone callback
    window.plusoneClicked = function (e) {
        setTimeout(function () {
            plusone.remove();
            plusone = null;
        }, 150);
    };
    
    // render plusone
    gapi.plusone.render(plusone[0], {
        size: 'small',
        count: false,
        href: 'http://img42.com',
        callback: 'plusoneClicked'
    });
    
    // follow the mouse
    $(window).bind('mousemove', function (e) {
        if (plusone) plusone.css({
            left: (e.clientX - 11),
            top: (e.clientY - 7)
        });
    });
});

script.src = 'https://apis.google.com/js/plusone.js';
window.document.getElementsByTagName('head')[0].appendChild(script);