mikepack/nerdbox — pull request #11 by mikepack (2014-06-10 04:08:39+00:00)
Title: Overflow

There's one major problem facing Nerdbox: overflow. It's difficult to allow the lightbox to collapse on the content and center when it's smaller than the current window, but grow and overflow when the content is larger than the window, to some threshold/margin. The scrollbars should be inside the lightbox, but the window shouldn't scroll.

My understanding of the problem: the browser can't vertically center the lightbox without being able to calculate it's child's height. When overflowing, it fails to calculate the content's height properly within the lightbox. One way to solve this is with a "shim", where we append the same content to a sibling element to the content container, so that the content container can calculate it's maximum height, and hence provide scrollbars when overflowing. The problem is in order for the content container to know its height, we have to duplicate the content inside the shim. Obviously bad.

This pull request is to remove the shim and provide a sane overflow without it. [demo.html](https://github.com/mikepack/nerdbox/blob/master/demo.html) has tests.

@jejacks0n @mkitt would love to get some thoughts/eyes on this. It's been plaguing Nerdbox for quite some time.