JSFiddle - React, Tailwind, and code Playground
by c_vilander
HTML
<div class="wrapper">
<div id="dropdown">
<p>Drop Down</p>
<div class="row_one"></div>
</div>
</div>
CSS
.wrapper {
margin: 0 auto;
width: 200px;
}
#dropdown {
position: relative;
top: 10px;
left: 0;
width: 150px;
height: 35px;
margin: 0;
padding: 0px 5px 2px 5px;
border-radius: 5px;
background: linear-gradient(to bottom, #393939 0%,#1a191a 100%);
cursor: pointer;
}
#dropdown p {
text-align: center;
font-family: Raleway, 'Helvetica Neue', Helvetica, sans-serif;
font-size: 14px;
font-weight: 100;
letter-spacing: 2px;
line-height: 38px;
color: #fff;
}
#dropdown:hover {
transition: 5s ease-in-out;
}
JavaScript
// Self-invoking function to get a local scope
(function () {
"use strict";
var dropdown = document.getElementById('dropdown');
dropdown.onclick = function () {
if (this.style.height === "150px") {
this.style.height = "35px";
} else {
this.style.height = "150px";
this.style.transition = "height 0.5s ease-in-out";
}
};
})();