I\'m looking for something to this effect:
$(window).scroll(function(event){
if (/* magic code*/ ){
// upscroll code
} else {
// downscrol
In case you just want to know if you scroll up or down using a pointer device (mouse or track pad) you can use the deltaY property of the wheel
event.
$('.container').on('wheel', function(event) {
if (event.originalEvent.deltaY > 0) {
$('.result').append('Scrolled down!
');
} else {
$('.result').append('Scrolled up!
');
}
});
.container {
height: 200px;
width: 400px;
margin: 20px;
border: 1px solid black;
overflow-y: auto;
}
.content {
height: 300px;
}
Scroll me!
Action: