open or close according to scroll velocity and scroll position