I have in the application on Yii2 in the Nav widget several menu items with drop-down sub-items and sub-items to one loaded from the database. So, it is in this menu item for li of the selected sub-item that the active class is not affixed, although in the remaining menu items everything works fine. I do not understand what's the matter, help, please.

  • Maybe because your submenu is loaded dynamically from the database via Ajax, and the class is set when the page is rendered - Ninazu
  • I experimented a bit and found out that this is all due to links like boarding-school / static-pages / page? Id = 3 That is, either in? Or in = When a link of this type is boarding-school / news-events / index -news , it works. However, I do not know what to do, because how can I transfer which page to load, if not by id? - sasha_lexi
  • Changed the type of links to boarding-school / static-pages / page / 4 , it still does not work. Maybe it's the number of investments? - sasha_lexi
  • It's hard to judge. Update the answer, and add the code NavBar, code specific action and config urlManager - Ninazu

0