There is a button and a drop-down menu, tell me please What should I do so after the click on a menu area it wont hide, and after the click out of the menu area it will hide? Now it opens by clicking, and closes by clicking on the button and on the menu area.
$(function(){
$('.click').click(function() {
$('.click-menu').slideToggle(200);
});
});
.click {
width: 100px;
height: 100px;
background-color: red;
text-align: center;
border-radius: 50%;
position: relative;
cursor: pointer;
}
.click span {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.click-menu {
display: none;
position: absolute;
top: 110px;
left: 50px;
}
.click-menu div {
width:300px;
text-align: center;
background-color: green;
margin-top: 10px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" href="main.css">
</head>
<body>
<div class="click">
<span>CLICK</span>
<div class="click-menu">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="main.js"></script>
</body>
</html>