This worked in the end:
document.addEventListener("click", function(event) {
// Check which element was clicked using event.target
if (event.target.matches("#about")) {
window.location.href = "about_me.html";
} else if (event.target.matches("#contact")) {
window.location.href = "contact_me.html";
} else if (event.target.matches("#home")) {
window.location.href = "home.html"
}
});