When the hover event is detected in any of the menus, the options must scroll down. When the mouse exits the options, I'm trying to hide those options, but for some reason it does not work. Why? I do not see anything wrong with the implementation of mouseout () in my code.
$(document).ready(function() {
$(".level1-option").hover(function(){
$(".sub-menu1-container").slideDown();
});
$(".sub-menu1-container").mouseout(function(){
$(".sub-menu1-container").slideUp();
});
});
* {
padding: 0;
margin: 0;
}
.header {
background: white;
height: 147px;
box-shadow: 1px 1px 15px grey;
position: relative;
}
.header-menu {
color: grey;
position: absolute;
right: 100px;
bottom: 20px;
}
.level1-option {
padding: 0 10px;
display: inline-block;
color: grey;
}
.level1-option:hover {
color: #e6b800;
cursor: all-scroll;
}
.sub-menu1-container {
margin: 0 5%;
background: white;
height: 337px;
box-shadow: 1px 1px 15px #8f8a8a;
position: relative;
z-index: -1;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" href="style.css">
<script src="jquery-3.2.1.min.js"></script>
<script src="jquery.js"></script>
</head>
<body>
<div class="header">
<div class="header-menu">
<ul style="list-style: none;">
<li class="level1-option">option 1</li>
<li class="level1-option">option 2</li>
<li class="level1-option">option 3</li>
<li class="level1-option">option 4</li>
<li class="level1-option">option 5</li>
<li class="level1-option">option 6</li>
</ul>
</div>
</div>
<div class="sub-menu1-container" hidden>
</div>
</body>
</html>