伙计们。我试图在点击时显示/隐藏移动菜单,但我不知道我做错了什么。如果您能帮助我,我将非常感激:
<script>
var menuToggle = document.getElementsByClassName('menuToggle');
var nav = document.getElementsByClassName('responsive-navigation');
menuToggle.addEventListener('click', () => {
if (nav === 'block') {
nav.style.display = "none";
} else {
nav.style.display = "block";
}
});
</script>
米脂
相关分类