Topic: Set class scrolled if collapsed navbar is toggled

DerLino free asked 2 years ago

Good evening,

if you are set the view width to minmal like 320px and you toggle than the navbar, than you can see that the nav-links are in conflict with the text in the intro div because there is no background color. How can I solve this problem like set a background color if the not scrolled navbar is toggled?

Thank you for every help!

Best regards Lino

Michał Duszak staff commented 2 years ago

Hello, you wish to set the background to be always white, just like it would be if you scrolled? If so, you can remove class ''navbar-scroll'' and set class ''bg-white'' instead.

DerLino free commented 2 years ago

No, I don't want that the background color is always white. It should be only white if the navbar is scrolled or the collapse menu is open in the "mobile phone view".

Michał Duszak staff answered 2 years ago

I see as for scrolled it's handled - I have added a simple event listeners for collapse. If you open the navbar and it is unscrolled - it will get white styles. Please see the snippet below. Is this the expected behaviour?


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



Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: MDB5 3.10.1
  • Device: Computer
  • Browser: Firefox
  • OS: Windows 11
  • Provided sample code: No
  • Provided link: Yes