Fix JavaScript error when search is not enabled (#66)
Check `mySearchToggle` exists before calling `addEventListener()` to prevent error when search toggle does not exist.
This commit is contained in:
parent
4a73bdb597
commit
c5623e2f38
|
@ -60,9 +60,11 @@ myMenu.addEventListener('click', function () {
|
|||
toggleClassMenu();
|
||||
animateMenuItems();
|
||||
}, false);
|
||||
mySearchToggle.addEventListener('click', function () {
|
||||
if (mySearchToggle) {
|
||||
mySearchToggle.addEventListener('click', function () {
|
||||
toggleClassSearch();
|
||||
}, false);
|
||||
}, false);
|
||||
}
|
||||
|
||||
// Toggle search input and content visibility
|
||||
function toggleClassSearch() {
|
||||
|
|
Loading…
Reference in New Issue