Detect the swipe direction on mobile devices