This links highlights what's new in Chrome 56:
One cool thing amongst others (bluetooth access is also cool but this one css feature is something I wish we had a while back) is position:sticky.
It's available in Chrome 56 (stable as of Jan 2017) and to summarize, it allows to fix an element into the viewport when it's within a threshold.
// Element will be "fixed" when it is 10px from the top of the viewport
You could set top : 0; to make it stick directly to the top of the viewport.
Have to be conscious that this positioning might not be available in other browsers as of yet.
There's this site I use to check what's available: http://caniuse.com/#search=sticky
As of now, it's not available in IE (not very surprising...)