JSFiddle - React, Tailwind, and code Playground

by zawex

HTML

<div id="carttool">
    <img id="cartsho" src="http://bigpicture.ru/wp-content/uploads/2012/12/uportilis-3.jpg" width="199" height="138" alt="корзина">
    </a>
    <div class="overlay">
        <div class="overlay-content">Lorem ipsum dolor sit amet,
            <br>consectetur adipisicing elit,</div>
    </div>
</div>

CSS

.overlay {
    visibility: hidden;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: rgba(0, 0, 0, 0);
    /* Радиус скругления для современных браузеров */
    /* Цвет фона */
}
#carttool {
    z-index:99999;
    position:absolute;
    margin-left:140px;
    margin-top:5px;
}
.overlay.active {
    visibility: visible;
}
.overlay-content {
    margin: 10px 100px 30px;
    margin-top:70px;
    position:absolute;
    width:250px;
    -webkit-box-shadow: 7px 7px 5px rgba(0, 0, 0, 0.6);
    /* Для Safari 3.0 */
    -moz-box-shadow: 7px 7px 5px rgba(0, 0, 0, 0.6);
    /* Для Firefox 3.5 */
    box-shadow: 7px 7px 5px rgba(0, 0, 0, 0.6);
    /* Для современных браузеров */
    padding: 10px;
    /* Поля вокруг текста */
    -webkit-border-radius: 10px;
    /* Радиус скругления для Safari 3.1 */
    -moz-border-radius: 10px;
    /* Для Firefox 3 */
    border-radius: 10px;
    background: #eeece0;
}
#cartsho {
    position:absolute;
    border-bottom: 1px dashed #0080ff;
}
#carttool img:hover {
    border-bottom: none;
}

JavaScript

var btn = $('#cartsho'),
    ovl = $('.overlay');

btn.on('click', function () {
    ovl.addClass('active');
});

ovl.on('click', function (e) {
    if (!$(e.target).hasClass('overlay-content')) {
        $(this).removeClass('active');
    }
});