JSFiddle - React, Tailwind, and code Playground
HTML
<ul id="categories" class="sections">
<li> <a href="#">Section</a>
<ul>
<li> <a href="#">kategori</a> </li>
</ul>
</li>
<li> <a href="#">Section</a>
<ul>
<li> <a href="#">kategori</a> </li>
<li> <a href="#">kategori</a> </li>
</ul>
</li>
</ul>
CSS
#categories li {
padding: 14px 0;
font-size: 12px;
width: 280px;
text-transform: uppercase;
font-weight: normal;
background-color: #ffffff;
background-image: url("../graphics/open.png");
background-repeat: no-repeat;
background-position: 240px center;
border-bottom: 1px solid #f3f3f3;
}
#categories li:hover {
background-color: #dadada;
}
#categories li a {
padding-left: 20px;
white-space: nowrap;
text-overflow: ellipsis;
}
#categories ul {
display: none;
}
#categories ul.selected {
display: block;
}
.sections ul li .selected ul {
line-height: 34px;
font-size: 12px;
text-transform: uppercase;
font-weight: normal;
background-color: #ffffff;
background-image: url("../graphics/close.png");
background-repeat: no-repeat;
background-position: 240px center;
}
.sections li {
background-color: #ffffff;
}
.sections li a:hover {
text-decoration: none;
}
JavaScript
$(document).ready(function(){
$('#categories li').click(function() {
$(this).find('ul').toggleClass('selected');
return false;
});
});