Improvements for modal positioning.

This is a work in progress snapshot. Modal height changes caused by
the delayed load of images are handled slightly better now. This could
be further improved by adding debouncing.