Takes into account -ve scroll values, and values greater than scrollHeight.