Showing 1 – 2 of 2 replies
Puzbie

How to prevent navbar elements autoexpanding for mobile use

Puzbie PURCHASED
9 months ago
Hi, I am getting to grips with your product, but have an issue with the Nav Menu. Lets say I have one like this:

Home
Articles - UK, France, Germany
Forum
Useful Links - Google, Youtube, Facebook
Admin

The Articles and Useful Links options will expand to reveal submenus as listed.

Ok, that works fine on desktop. However, if I shrink the screenwidth, the mobile version kicks in. But if I open the menu, I find that the Articles and Useful Links submenus are already open. I am trying to collapse them so that they only open when you click the caret. But there is no caret.

My real menu is much bigger than the above, and having it fully opened in mobile is far from ideal.

I tried the example on the Bootstrap 5 website too. It works fine there, but if I copy the code into my test html page with all your Smarty stuff loaded, then it autoexpands again.

https://getbootstrap.com/docs/5.2/examples/navbars-offcanvas/

What do I need to do to bring the caret back in mobile?

Thanks
stepofweb
stepofweb SELLER
9 months ago
Hello Puzbie,

Indeed, the first level of main menu is always open by default on mobile.

Smarty was released few years ago and I don't remember why I did this as default.
Nobody else complained for this so I never changed - now I can't change de default because all existing websites would be affected when they update.

So to solve this issue, I have added a new class so you can have collapsible menus.
You can add the class in 2 ways:
1 .navbar-nav.dropdown-collapsible (all menu items collapsible)
2 .navbar-nav .nav-item.dropdown.dropdown-collapsible (specific menu item collapsible)

The second option allows you to have only specific ones collapsible, not all of them.

Gmail do not allow javascript files as attachment so this is the link to download the files (just replace them in your /assets/ folder):
https://smarty.stepofweb.com/fixes/fix_5.0.6.zip

This will be added to next official update too.

Thanks,
Dorin Grigoras

Last edited 9 months ago

Puzbie
Puzbie PURCHASED
9 months ago
Worked perfectly! Thanks for the help.