JSFiddle - React, Tailwind, and code Playground
by Hugo Carneiro
HTML
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<section class="container-fluid slide-over">
<div class="row">
<div class="col-sm-12">
<div class="fl-custom-dropdown">
<div class="fl-expand-control">
<i class="fa fa-chevron-down" aria-hidden="true"></i>
</div>
<ul>
<li>Cost to USD</li>
<li>PPP</li>
<li>Location factors</li>
</ul>
</div>
</div>
</div>
</section>
CSS
.fl-custom-dropdown {
position: relative;
margin-top: 30px;
max-height: 132px;
height: 44px;
overflow: hidden;
transition: all 0.25s ease-out;
border: 1px solid rgba(0,0,0,0.1);
}
.fl-custom-dropdown.expanded {
height: 132px;
}
.fl-custom-dropdown .fl-expand-control {
position: absolute;
top: 0;
right: 0;
width: 44px;
height: 44px;
line-height: 44px;
font-size: 18px;
text-align: center;
cursor: pointer;
}
.fl-custom-dropdown.expanded .fl-expand-control {
display: none;
}
.fl-custom-dropdown ul {
list-style: none;
padding: 0;
margin: 0;
cursor: pointer;
}
.fl-custom-dropdown.expanded ul {
cursor: default;
}
.fl-custom-dropdown ul li {
height: 44px;
line-height: 44px;
padding: 0 44px 0 15px;
cursor: pointer;
}
.fl-custom-dropdown.expanded ul li {
padding: 0 15px;
cursor: pointer;
}
.fl-custom-dropdown.expanded ul li:hover {
background-color: #00abd1;
color: #ffffff;
}
JavaScript
$('.fl-custom-dropdown ul').on('click', function() {
$(this).parents('.fl-custom-dropdown').addClass('expanded');
$(this).parents('.fl-custom-dropdown').addClass('expanded');
});