Limit maximum scroll and try to improve cross-platform height detection