var $window = $(window),
lastScrollTop = 0;
function onScroll (e) {
var top = $window.scrollTop();
if (lastScrollTop > top) {
console.log('top');
} else if (lastScrollTop < top) {
console.log('down');
}
lastScrollTop = top;
}
$window.on('scroll', onScroll);