typpo/codenav — pull request #6 by int3h (2014-07-31 07:51:10+00:00)
Title: Modify scrolling behavior (fixes #5)

This pull request modifies how codenav handles scrolling, and in the process fixes typpo/codenav#5 .

The old behavior was to give the code blob container a definite size, then set `overflow: scroll` on it to scroll through the code (but not the page as a whole.) This allowed codenav to place the line markers container easily, since it could also be of definite size and always be visible next to the code.

The new behavior is to allow the code blob container to be naturally sized to fit the code (like it is on vanilla github code pages.)

The tricky bit is placing the line marking container. We set its height to be the height of the window, and initially overlay it at the top-right corner of the code listing. However, when the user scrolls down, the line marking container fixes itself relative to the viewport so that it's always visible next to the code as they scroll. (It's easier to see in action than to describe.)

I haven't tested all the corner cases, so there may still be bugs lurking. The UI design may also benefit from a little polish. But it does both fix the problem with scrolling (#5) and with keeping line markings easily visible.