Add listener that detects scroll direction