Adding Extra CSS Class to header.php when scrolling
Since Many days I was trying to make a sticky header for websites and I know what to do for that but didn’t know how to do that.
I was trying to set a transparent header when the website is not scrolling but wanted to add header background color when it is scrolling, so that the header transparent go and make the header readable when it is scrolling. I knew that if I can add an extra class to wordpress header class when it is scrolling then I will be done. So finally I got the way for it. Just add the following code snipet to your wordpress theme function file and then manage it according to your need.
After this just call that CSS class (in this case shrink) to your theme style.css file and you are done.
Hope this helps to everybody.