tags:

views:

38

answers:

1

let's assume i have a div element, with static height and width

<div style="height: 500px; width: 300px;" id="scrollable">

how can i fix the moment, when mouse scrolls up on this div?

is there something like

$("#scrollable").scrollup(function()
{
     console.log("scrolled");//???
});

Thanks

Update:

i'm sorry for not clearly asked question, but as mentioned in the comment,

i need a event that detects mouse wheel movement, up and down.is it possible?

A: 

try this:

var scrollTop = $("#scrollable").scrollTop();
$("#scrollable").scroll(function(){
    if(scrollTop>$(this).scrollTop()) { alert('hi'); }

    scrollTop = $(this).scrollTop();
});​

with this div:

<div style="height: 500px; width: 300px; background: #eee; overflow: auto;" id="scrollable"><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br></div>​

or try this here live: http://jsfiddle.net/St4fW/1/

Vaibhav Gupta