set animation direction when clicking links