I'm currently working on a full screen navigation menu that opens when I click the hamburger icon.(我目前正在使用全屏导航菜单,当我单击汉堡包图标时会打开。)
Right now I am able to toggle the navigation by adding a class called "open" that triggers when I click on the menu.(现在,我可以通过添加一个名为“ open”的类来切换导航,该类在单击菜单时触发。) But I am stuck when it comes to closing it.(但是在关闭它时,我陷入了困境。) Could you review my code and let me know what I'm missing?(您能否查看我的代码并让我知道我所缺少的内容?)
$(document).ready(function() { $('#menu').on('click', function() { $('.overlay').addClass('open'); $('#menu').removeClass('open-menu'); $('#menu').addClass('close-menu'); }); $('.#menu').on('click', function() { $('.overlay').removeClass('open'); $('#menu').addClass('open-menu'); $('#menu').removeClass('close-menu'); }); });
ask by Oscar Diaz translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…