Topic: Set class scrolled if collapsed navbar is toggled

DerLino free asked 10 months 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?

https://mdbootstrap.com/snippets/standard/mdbootstrap/2946064

Thank you for every help!

Best regards Lino


Michał Duszak staff commented 10 months 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 10 months 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 10 months 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?

https://mdbootstrap.com/snippets/standard/m-duszak/3606115#js-tab-view


FREE CONSULTATION

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

Status

Closed

Specification of the issue

  • User: 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