How to Create a Sticky Navigation Bar with Jquery and have it Fade?

How would I create a sticky position bar that can “fade” to a different color or other CSS classes?


Except there would be a SMOOTH transition to another color or CSS property when you get the navbar position fixed.

You could probably do this with just CSS transitions. In the example, you could add something like this to the .sticky class in the CSS:

transition: background-color .5s;
background-color: #3cf;