Issue
This Content is from Stack Overflow. Question asked by David Akampulira
on second click on nav_item, menu doesnot close but only closes when i click outside. i need to be able to close and open with only the nav_item with js.
.menu_content{
position: absolute;
top:100px;
opacity: 0;
pointer-events: none;
display: flex;
}
.menu_content:focus, .menu_content:focus-within{
opacity: 1;
pointer-events: visible;
}
.nav_item{
display: -webkit-box;
display: -ms-flexbox;
-webkit-box-align: right;
-ms-flex-align: center;
align-items: center;
height: 76px;
position: absolute;
right: 0;
top: 10px;
font-weight: normal;
}
.nav_item:focus + .menu_content, .nav_item:focus-within + .menu_content {
opacity: 1;
pointer-events: visible;
}
Solution
This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.
This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.