I removed all the home/close stuff, but I don’t know where it is being moved to, and how.
https://jsfiddle.net/1jac0yqe/
Would I be placing it all inside a new function?
I don’t think you meant for the function name to be called interface, or maybe you did.
I changed it to userInterface()
(function userInterface() {
function showHome() {
const theActive = document.querySelector(".with-curtain.active");
const theHides = document.querySelectorAll(".hide");
const theBody = document.querySelector("body");
theActive.classList.remove("active");
theHides.forEach(function(removeHide) {
removeHide.classList.remove("hide");
});
theBody.classList.toggle("bodytoggle");
}
function homeClickHandler(evt) {
const home = evt.currentTarget;
showHome(home);
}
function addClickToHome(goHome) {
goHome.forEach(function addEventHandler(goHome) {
goHome.addEventListener("click", homeClickHandler);
});
}
function addCloseHandler(closeSelector, handler) {
const close = document.querySelector(closeSelector);
close.addEventListener("click", handler);
}
function init(selectors) {
const goHome = document.querySelectorAll(".home");
addClickToHome(goHome);
}
return {
addCloseHandler,
init
};
}());