и тоже самое без jQuery
var lastScrollTop = 0;
window.onscroll = onScroll;
function onScroll (e) {
var top = window.pageYOffset;
if (lastScrollTop > top) {
console.log('top');
} else if (lastScrollTop < top) {
console.log('down');
}
lastScrollTop = top;
}