Make a nav bar stick to the top when scrolling with

I have seen the info on creating fixed sticky nav bars, however, I’m wondering if there’s a way to do a navbar that’s below a banner image yet when scrolls, sticks to the top of the window and returns to it’s original state when scrolled back up.

There are some solutions other users have come up; specifically you can take a look at this solution: