Skip to content
Advertisement

Bootstrap 4 navbar-toggler button doesn’t work when located at specific sites

At first, my navbar in ADMIN desktop view is like this. This works without any problems. The “add” button is only seen by admin, like the “edit” button from every product.

enter image description here

When in mobile version, It looks like this.

enter image description here

When I press the “hamburger” button, It looks like this.

enter image description here

The problem comes in other linked sites. When I press the “hamburger” button, It shows the sites. Now I can navigate to those sites and then FROM those sites navigate to other sites EXCEPT when I go to “add” and “edit” site. When on those sites the “hamburger” button doesn’t open (doesn’t work), leaving me to go back by browser arrows.

enter image description here

enter image description here

The code from my header, where navbar is located.

JavaScript

The code from add file:

JavaScript

The code from edit file:

JavaScript

Advertisement

Answer

My project is divided in multiple files. I am using “header” and “footer” files for header and footer. With PHP, I just include them in other files, so I don’t need to write the code all over again or fix everyting seperetly.

The problem was that when I made a file for admin only, I forgot to include a script link that made the “hamburger” button functional.

I forgot it because, It didn’t matter, because anyway only I can see the admin file. That’s why I forgot about the script that I included in the footer. Don’t make the same mistake.

The answer is, I included the footer in the “edit” and the “add” files at the bottom, and it worked. or you could just paste the script. That would work too.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement