JSFiddle - React, Tailwind, and code Playground

by crowjonah

HTML

<div class="wrap"></div>
<div class="instructions">Click somewhere on the black</div>

CSS

body {
    background: black;
    cursor: pointer;
}
.wrap {
    position: absolute;
    top: 100px;
    left: 100px;
    margin-left: -100px;
    margin-top: -100px;
    width: 200px;
    height: 200px;
    background-color: white;
    background-image: url(http://californiatortilla.com/caltort/wp-content/uploads/2012/11/Steak-taco1.jpg);
    background-position: 0 0;
    background-size: 600px auto;
    background-attachment: fixed;
    background-repeat: no-repeat;
    border-radius: 100%;
    cursor: pointer;
}

.instructions {
    color: #fff;
    position: absolute;
    width: 100%;
    left: 0;
    bottom: 5px;
    text-align: center;
    -webkit-transition: opacity 200ms ease;
    transition: opacity 200ms ease;
}

.instructions.hidden {
    opacity: 0;
}

.instructions:hover {
    opacity: 1;
}

JavaScript

var wrap = $('.wrap'),
    instructionsVisible = true,
    instructions = $('.instructions');

$(document).on('click', function (evt) {
    if (instructionsVisible) {
        instructions.addClass('hidden');
    }
    instructionsVisible = false;
    wrap.animate({
        top: evt.clientY || evt.offsetY || evt.pageY,
        left: evt.clientX || evt.offsetX || evt.pageX
    }, 150);
});