Header changing color when scrolling

Hello all, The new guy again. I am trying to have my header bar turn white when I scroll down my page. I did it a time back but for the love of me I cannot remember where.

I have shown 2 samples of what I mean to achieve. Thanks