JSFiddle - React, Tailwind, and code Playground

HTML

<div id="overlay">
        </div>
        <div id="imgcontainer">
            <div>
                <div id="source">
                </div>
            </div>
        </div>

CSS

#overlay {
    position: absolute;
    z-index: 1;
    opacity: 0;
    background-color: black;
    display: none;
    top: 0;
    left: 0;
}

#imgcontainer > div {
    background-color: #E2E2E2;
    height: 600px;
    margin: auto;
    width: 500px;
    z-index: 4;
}

#imgcontainer {
    display: none;
    left: 0;
    opacity: 1;
    position: fixed;
    right: 0;
    top: 100px;
}

#source {
    background-color: #e2e2e2;
    z-index: 5;
    height: 100px;
    width: 200px;
    margin: 50px;
}

JavaScript

$(function(){
    $("#source").css({
        opacity: "0",
    });
    $("#overlay").css({
        width: $(window).width(
        right: "0",
        top: "100px",
        display: "block"
    });
});