Determine when to scroll content back to top dynamically