Problem with drop-down menu

Can you please help me with this issue? My dropdown menu doesn’t pop up. It did in the beginning, but suddenly it disappeared and I don’t really know how to get it back?

Obs! Here is my javascript by the way.

document.addEventListener(“click”, e => {
const isDropdownButton = e.target.matches(“[data-dropdown-button]”)
if (!isDropdownButton && e.target.closest(“[data-dropdown]”) != null)
return

let currentDropdown
if (isDropdownButton) {
    currentDropdown = e.target.closest("[data-dropdown]")
    currentDropdown.classList.toggle("active")
}

document.querySelectorAll("[data-dropdown].active").forEach(dropdown => {
    if (dropdown === currentDropdown) return
    dropdown.classList.remove("active")
})

})

As far as I can see that JavaScript looks the same as in the video (at time 10:56). I suggest you check your HTML against the HTML in the video (after it is modified after time 10:56).

I have not watched much of the video: it’s really heavy going and the speech is rather fast :grinning:

I saw your HTML, JavaScript and CSS in post #19 before you changed the attached files. I saw your dropdown working. If someone in the forum is going to work out why your dropdown is no longer working you need to attach those file again or put the HTML, JavaScript and CSS into CodePen.

EDIT (following move of posts):
Video is here: https://www.youtube.com/watch?v=S-VeYcOCFZw&t=139s.
Post #19 is here: https://www.youtube.com/watch?v=S-VeYcOCFZw&t=139s

Off Topic:

@Apache: I have moved these posts into a new topic, as the question is unconnected to your logo issues.

Please start a new thread for a new question.

In the files you added in the other thread you had the script called scripr.js but in the html you called it script.js.

Screen Shot 2022-05-19 at 19.22.34

If that is a typo then correct it and try again.

1 Like

Oh! My God, you just solved the problem that I was so confused about. You are a genius bro. Thanks a lot for saving me a bunch of time by debugging this issue :smiley:

2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.