JSFiddle - React, Tailwind, and code Playground

by gionaf

HTML

<div class="col">
    <div class="purecss target">Pure CSS</div>
</div>
<div class="col">
    <div class="fallback target">Javascript fallback</div>
</div>
<div class="intro">pick one</div>

CSS

.is-animated {
    -webkit-animation:byebye 750ms 1;
    -moz-animation:byebye 750ms 1;
	-o-animation:byebye 750ms 1;
    animation:byebye 750ms 1;
    height:0; opacity:0;
}

@-webkit-keyframes byebye {
    0%{ opacity:1; height:100px; }
    100%{ opacity:0; height:0; }
}
@-moz-keyframes byebye {
    0%{ opacity:1; height:100px; }
    100%{ opacity:0; height:0; }}
@-o-keyframes byebye {
    0%{ opacity:1; height:100px; }
    100%{ opacity:0; height:0; }
}
@keyframes byebye {
    0%{ opacity:1; height:100px; }
    100%{ opacity:0; height:0; }
}

html,body,.col{ min-height:100%; height:100%; margin:0; }
.col { float:left; position:relative; width:50%; }
.intro { position:absolute; top:50%; right:0; left:0; line-height:0; text-align:center; }
.target { position:absolute; top:0; right:0; bottom:0; left:0; width:200px; height:100px;
        cursor:pointer; margin:auto; overflow:hidden;
        line-height:100px; text-align:center; background:khaki; }

JavaScript

var $purecss = $('.purecss'),
    $fallback = $('.fallback');
$purecss.on('click',function(){
    $purecss.addClass('is-animated');
});
$fallback.on('click',function(){
    $fallback.animate({height:0,opacity:0},750);
});