I’m currently improving my website for the use with mobile devices. Therefore I’m trying to open a menu with a click onto a equiv
button. The menu is a fixed div with scrollable content and should appear and disappear with a click onto the button. Either option is working if set through the display
property in CSS, but I’m not able to toggle the visibility through JavaScript.
function ToggleDiv() {
var v = document.getElementById('equiv-submenu');
if (v.style.display == '' || v.style.display == 'none') {
v.style.display = 'block';
}
else {
v.style.display = 'none';
}
}
<div id="equiv" onclick="ToggleDiv()">
<p>≡</p>
</div>
<div id="equiv-submenu">
<div id="equiv-submenu-content">
...
</div>
</div>