JSFiddle - React, Tailwind, and code Playground
HTML
<div id="helper"></div>
<div id="hideMe"><div>Tab #1</div><div>Tab #2</div><div>Tab #3</div></div>
<div id="content">Tab #1 content here ...</div>
CSS
html, body {
height:100%;
margin:0;
padding:0;
width:100%;
}
div#helper { height: 5px; }
div#hideMe {
height: 0;
overflow: hidden;
}
div#hideMe > div {
border: 1px solid black;
display: inline-block;
padding: 5px;
}
div#content {
border: 1px solid black;
height: 50%;
width: 90%;
}
JavaScript
var element = document.querySelector("div#helper");
var sibling = element.nextElementSibling;
element . onmouseover = sibling . onmouseover = function ( event ) {
if ( getComputedStyle ( sibling ) . height === "0px" ) {
event . stopPropagation ();
}
sibling.style.height = sibling.scrollHeight + "px";
};
element . onmouseout = sibling . onmouseout = function () {
sibling . style . height = "0";
};
var timing = sibling.scrollHeight / 100 + "s linear";
sibling.style.transition = "height "+timing;