var posWas;

$(window).bind('scroll', function(){ //when the user is scrolling...
	var pos = $(window).scrollTop(); //position of the scrollbar
	
	if(pos > posWas){ //if the user is scrolling down...
		//do something
	}
	if(pos < posWas){ //if the user is scrolling up...
		//do something
	}
	posWas = pos; //save the current position for the next pass
})

Minor bit of code I thought I'd share that allows you to execute code based on the direction a user is scrolling. Obviously, this could easily be adapted for horizontal scrolling too.