Refactored scrollview detection for scroll to top