js代码
<script> const menu = document.querySelector('#toggle'); const menuItems = document.querySelector('#overlay'); const menuContainer = document.querySelector('.menu-container'); const menuIcon = document.querySelector('i'); function toggleMenu(e) { menuItems.classList.toggle('open'); menuContainer.classList.toggle('full-menu'); menuIcon.classList.toggle('fa-bars'); menuIcon.classList.add('fa-times'); e.preventDefault(); } menu.addEventListener('click', toggleMenu, false); </script>