skip to Main Content

I had an wordpress website and its mobile version hamburger menu is not working as I tried adding the script too. How to get that menu button working.

Below I had providing the link for the website which the menu is not working.

https://drisharikganesh.com/

Code:

// Events Listeners
hamburgerMenu.addEventListener("click", toggleNav);
navItems.forEach((nav) => {
  nav.addEventListener("click", toggleNav);
});

Still its not working and where it should be added, please help me to get this working.

2

Answers


  1. <script>
    document.querySelector(".navbar-toggle.tablet-responsive").addEventListener('click',()=>{
        document.querySelector(".navbar-collapse").classList.toggle("collapse")
    })
    </script>
    

    Install "code snippets" plugin from plugins. Add this code to your footer area. If you have any problems, please search on google "how to add javascript code to footer with code snippets" or something similar. You should be good.

    Login or Signup to reply.

  2. `burger = document.querySelector('.burger')
    navbar = document.querySelector('.navbar')
    rightnav = document.querySelector('.rightnav')
    navList = document.querySelector('.nav-List')
    
    burger.addEventListener('click',()=>{
        navbar.classList.toggle("h-nav-resp");
        navList.classList.toggle("v-class-resp");
         rightNav.classList.toggle("v-class-resp");
                                        `
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search