fixed swipe function to prevent vertical swipe