Topic: navbar color not changing on scroll

Santosh Kumar free asked 3 years ago

$(window).scroll(function(){ $('nav').toggleClass('scrolled', $(this).scrollTop() > 1080); });

.fixed-top.scrolled { background:#fff !important; } hello i am using this code to change my nav color while scroll but it is not working kindly help me

Marcin Luczak staff commented 3 years ago


Please create a snippet with your whole code of the navbar. Without the context, it will be difficult to find what is wrong.

Keep coding,


Please insert min. 20 characters.


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: General Bootstrap questions
  • MDB Version: -
  • Device: system
  • Browser: google chrome
  • OS: intel duel core
  • Provided sample code: No
  • Provided link: No