simplify mobile submenu event listener code

This commit is contained in:
Aadil Ayub 2022-04-13 22:50:24 +05:00
parent 58c5a42873
commit 5ca22cce04

View File

@ -31,8 +31,8 @@
// for toggling submenus in mobile navigation drawer
let submenuLinks = document.querySelectorAll('.drawer .has-submenu');
[...submenuLinks].forEach(function(submenuLink) {
submenuLink.addEventListener('click', () => {
[...submenuLinks].forEach(submenuLink => {
submenuLink.addEventListener('click', function() {
submenuLink.querySelector('.submenu').classList.toggle('opened')
})
})