codeforamerica/codeforamerica.org — pull request #61 by Mr0grog (2014-01-12 03:21:40+00:00)
Title: Fix header so that it doesn't shrink until the page is scrolled all the way to it

Right now, the sticky navigation gets a different class that causes it to stick to the top of the page and shrink about 70px before the page is actually scrolled to it. This makes it jump up slightly, which is a bit jarring (especially when we've gone to pains to animate the shrinking!).

This switches to using `getBoundingClientRect()` to measure the navigation's position on the page since it can work independent of how the page is structured (the old algorithm had to know what elements were placed before the navigation) *and* so that the position will always be as accurate as possible (`getBoundingClientRect()` will give you subpixel position information, while `offsetHeight/Width/Left/Top` will not).

Hope this is helpful!