Topic: navbar-toggler does not close on in-page links.

Hikeout design priority asked 10 months ago


I have a question about the smartphone menu (navbar-toggler). When you click the navbar-toggler button on an in-page link and then click the menu to change the page, navbar-toggler does not close. How do I make it disappear?

I am using the following sources. https://mdbootstrap.com/docs/standard/navigation/headers/


Hikeout design priority commented 10 months ago

以下のソースで解決しました。

document.querySelectorAll('.navbar-nav a').forEach(anchor => { anchor.addEventListener('click', function () { document.querySelector('.navbar-toggler').click(); }); });


Kamila Pieńkowska staff commented 10 months ago

Do you have additional questions?



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Opened

Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 7.0.0
  • Device: PC
  • Browser: chrome
  • OS: windows10
  • Provided sample code: No
  • Provided link: Yes