event handling only when vertical movement