JSFiddle - React, Tailwind, and code Playground

by lukerichison

HTML

<button class="css">show me with css</button><br/>
<button class="jquery">show me with jQuery</button><br/>
<button class="cssaccel">show me with css, hardware accelerated</button><br/>
<div class="css"></div>
<div class="cssaccel"></div>
<div class="jquery"></div>

CSS

</style><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /><style>
body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

div {
    overflow: hidden;
    position: absolute;
    height: 100%;
    width: 95%;
    top: 0;
}
div.css,
div.cssaccel {
    right: 100%;
    background-color: salmon;
    -webkit-transition: right 0.6s, box-shadow 0.6s;
       -moz-transition: right 0.6s, box-shadow 0.6s;
        -ms-transition: right 0.6s, box-shadow 0.6s;
         -o-transition: right 0.6s, box-shadow 0.6s;
            transition: right 0.6s, box-shadow 0.6s;
    box-shadow:
        0 0 0 0 rgba(0,0,0,0),
        0 0 0 200em rgba(0,0,0,0);
}
div.cssaccel {
    background-color: coral;
   -webkit-transform: translateZ(0);
      -moz-transform: translateZ(0);
       -ms-transform: translateZ(0);
        -o-transform: translateZ(0);
           transform: translateZ(0);
    -webkit-perspective: 1000;
       -moz-perspective: 1000;
        -ms-perspective: 1000;
            perspective: 1000;
}
div.jquery {
    background-color: purple;
    display: none;
}
div.jquery,
div.on {
    right: 5%;
    box-shadow:
        0 0 20px 0 rgba(0,0,0,1),
        0 0 0 200em rgba(0,0,0,0.6);
}

JavaScript

$('button.css').click(function(){
    $('div.css').addClass('on').click(function(){
        $(this).off('click').removeClass('on');
    });
});
$('button.cssaccel').click(function(){
    $('div.cssaccel').addClass('on').click(function(){
        $(this).off('click').removeClass('on');
    });
});
$('button.jquery').click(function(){
    $('div.jquery').show('drop', {direction:'left'}).click(function(){
        $(this).off('click').hide('drop', {direction:'left'});
    });
});