#Adjust Header When Scrolled
This snippet comes from Bill Erickson. This jQuery script adds a class you can use to style the header based on the scroll position on the page. The script's markup is written around the wordpress and the genesis framework and may need to be modified to work with your markup.
The markup in the js is using elements from the Genesis Framework, so adjust to your situation.
This code adds a class of “shrink” to the header, which you can use to change the header. It also adds a div class="bumper" which you can set to the height of the old header. Without this, you’d see the site’s content jump up when you position: fixed; the header.
See the comment in the code for more detail.
For additional customization, see the notes and codex links under References.
#Refrance
API:
-https://api.jquery.com/scrollTop/
Notes:
-http://www.billerickson.net/code/adjust-header-scrolled/
-https://journalxtra.com/wordpress/quicksnips/make-wordpress-theme-headers-shrink-on-scroll/
-http://ozzyrodriguez.com/tutorials/fixed-header-wordpress/
-https://gist.github.com/srikat/7867185