Headhesive.js creates an on-demand sticky header. Specify where you want your header to become fixed and the rest is magic. It's a standalone JavaScript plugin with no dependancies.
Website Demo