Make use of CSS position: fixed

Instead of changing top: on scroll, use position: fixed when the scroll
hits top and bottom boundaries (of container) to prevent shaky behavior.