function hideAllButtons(button) {
const buttons = button.querySelectorAll(".play, .pause, .speaker");
for (let i = 0; i < buttons.length; i += 1) {
hide(buttons[i]);
}
}
I tried to insert the jacket code in there but wasn’t able to figure it out.
I got it partially working, but the covers aren’t being hidden for some reason.
function addCoverListener(cover) {
const covers = cover.querySelectorAll(".jacket");
for (let i = 0; i < covers.length; i += 1) {
cover.addEventListener("click", coverClickHandler);
hide(covers[i]);
}
}
}());
Where in your code do you actually call this function? Your manageCover function doesnt actually do anything. It creates a series of local functions and then… does nothing with them.
The answer to that question depends on how you call the function, so I cannot answer your question until you fix the first problem, THEN you can work on the second.
That’s not how you’re calling the function, that’s how you’re defining the function.
You’ve told your chef HOW to make a cheesecake.
You have not told your chef to actually MAKE the cheesecake, nor given them the ingredients.
Your chef has not made any cheesecake.
You are asking me why the chef’s cheesecake is made with cream.
I need to be calling this but don’t understand how it would be done. addCoverListener
It would be called outside of the function.
function addCoverListener(cover) {
const covers = cover.querySelectorAll(".jacket");
for (let i = 0; i < covers.length; i += 1) {
covers[i].addEventListener("click", coverClickHandler );
}
}
}());