JSFiddle - React, Tailwind, and code Playground
by ozzon91
HTML
<ul class='menu_left'>
<li class='border_bot' style='width: 116px;'><a href="#">Logo muvik</a></li>
<li class='border_bot dropdown_menu'><span>Dota 2</span>
<ul class='head_dropdown'>
<li><a href="#">CS:GO</a></li>
<li><a href="#">LINEAGE 2</a></li>
<li><a href="#">DOTA 2</a></li>
<li><a href="#">BUTTLEFIELD 3</a></li>
</ul>
</li>
<li class='cat_item'><a href="#">Каталог</a></li>
</ul>
CSS
body {background: #141414;}
.head_dropdown {display: none;}
.menu_left .dropdown_menu:hover > .head_dropdown {
display: block;
}
.border_bot {
border-bottom: 2px #ED1C24 solid;
}
.menu_left {
background: #000;
list-style: none;
position: relative;
display: inline-block;
font-family: arial;
width: 100%;
padding: 0;
}
.menu_left:after {
content: ""; clear: both; display: block;
color:#ffffff;
}
.menu_left li {
float: left;
color:#ffffff;
height: 40px;
}
.menu_left li a {
display: block;
text-decoration: none;
color:#ffffff;
height: 40px;
}
.dropdown_menu {
line-height: 40px;
}
.dropdown_menu span {
border-left: 1px #282828 dashed;
border-right: 1px #282828 dashed;
display: block;
padding-right: 20px;
padding-left: 20px;
height: 30px;
line-height: 30px;
}
.head_dropdown {
background-color: rgba(0, 0, 0, .5);
position: absolute;
top: 42px;
width: 163px;
height: 151px;
padding: 0;
}
.head_dropdown li {
float: none;
position: relative;
background-color: #141414;
width: 143px;
height: 30px;
margin-top: 4px;
margin-left: 10px;
line-height: 30px;
list-style: none;
}
.head_dropdown li:first-child {
margin-top: 10px;
}
.cat_item {
margin-left: 20px;
}
.head_dropdown li a {
color: #999999;
display: block;
padding-left: 6px;
text-decoration: none;
width: 137px;
height: 30px;
}
JavaScript
$('.head_menu').mouseenter(function() {
$('.head_dropdown').css({height: '0'});
$('.head_dropdown').animate({height: '152px'}, 150);
}).mouseleave(function() {
$('.head_dropdown').animate({height: '0'}, 150);
});
$('.head_dropdown li').on('click', function() {
var tex = $('.in_top').text();
$('.head_dropdown li').find('a').removeClass('current_head_item');
$(this).find('a').addClass('current_head_item');
var chois = $(this).find('a').text();
$('.in_top').text( chois );
});