Straight fork of Scroll To Top Then Fixed Navigation Effect With jQuery and CSS by Stan Kostadinov
Could use .toggleClass instead of add/remove, saves you a couple lines:
$('nav').toggleClass('fixed', $(window).scrollTop() > navHeight);
The thing is in that header "sticks" to top? Why don't you use position: sticky in CSS instead?
@JTParrett @marthknoxmk @smellyshovel The picking of this pen caught me off guard. Maybe this is awkward but I would rather have the comments on stanhub.com , because it feels weird to me replying on something that is not of my own making.
The only thing that throws me off is the fixed height value. Other than that it's superb.
Need to know how to enable it? Go here.