Hi, sorry for the delay! You’d need to use this option data-sm-options="{ markCurrentItem: true }"
– this will make sure the script adds the “current” class automatically to the <a>
element linking to the current URL.
And then include some additional JS at the end of you pages – something like this:
// SmartMenus jQuery + Bootstrap 4 - expand active sub menu on mobile toggle button click
$('.navbar-toggler').click(function() {
var $nav = $('.navbar-nav');
if (!$(this).is('[aria-expanded="true"]')) {
// use the timeout to make sure it works after the navbar is expanded by the BS JS
setTimeout(function() {
$nav.smartmenus('itemActivate', $nav.find('a.current').eq(-1));
}, 1);
} else {
$nav.smartmenus('menuHideAll');
}
});
(You may need to change the selectors if you have multiple .navbar-toggler
/.navbar-nav
elements on your pages.)