JSFiddle - React, Tailwind, and code Playground

by maheshsapkal

HTML

<div id="expandable">
    <span>Hover over me</span>
    
    <ul>
        <li>List 1</li>
        <li>List 2</li>
        <li>List 3</li>
        <li>List 4</li>
    </nav>
</div>

CSS

#expandable {
    width: 100%; height: 50px;
    background: #ddd;
    overflow: hidden;
    font-family: sans-serif;
    font-size: 17px;
}
#expandable.dropped { 
    background: #666; 
    color: white; 
    border-bottom: 1px solid #111 }

#expandable span {
    display: block;
    width: 100%; height: 50px;
    line-height: 50px; text-align: center;
    cursor: pointer;
}
#expandable ul {
    width: 100%;
    line-height: 50px;
}

JavaScript

$("#expandable").click(function() {
    $(this).stop().animate({"height":"300px"},1000).addClass("dropped");
});