When clicking on an icon, a function should be called that looks, if the element has properties: display: none, then make it display: block, and vice versa.
There are no errors in the console
function AdaptiveMenu() { var Adaptive = document.getElementById('menu'); var AdaptiveStyle = getComputedStyle(Adaptive); if (AdaptiveStyle.display == 'none') { AdaptiveStyle.display == 'block'; }; } .ico { margin-left: 20px; } .rect { width: 30px; height: 6px; background-color: black; margin-top: 3px; } .menu { display:none; } <div class="ico" onclick='AdaptiveMenu'> <div class="rect"></div> <div class="rect"></div> <div class="rect"></div> </div> <nav class="menu" id="menu"> <ul> <li>lit-item</li> <li>lit-item</li> <li>lit-item</li> <li>lit-item</li> </ul> </nav>
и наоборот.- where is your "opposite"? - Alexey Shimanskyonclick='AdaptiveMenu()'; 2) instead of assignment, you make a comparison, you need this:AdaptiveStyle.display = 'block';; 3) This line will not work anyway, because this is a read-only style object, the styles need to be changed near the element itself:Adaptive.style.display = 'block';- andreymal