JSFiddle - React, Tailwind, and code Playground

by Andrew Dunai

HTML

<div class="g1">G1</div>
<div class="g2">G2</div>

CSS

.g1, .g2 {
    display: none;
    background: blue;
    color: white;
    padding: 10px;
}
.g2 {
    background: red;
}

JavaScript

var G1 = $('.g1');
var G2 = $('.g2');

function hideG1(){
    G1.hide();
    G2.show();
    setTimeout(hideG2, 2000);    // 2 seconds
};

function hideG2(){
    G2.hide();
    G1.show();
    setTimeout(hideG1, 1000);    // 1 second
};

hideG1();