I have the following jquery to handle scroll events on a particular div and write some content:
$('#myDiv').scroll(function(eventData) {
if(eventData.isGoingUp)
$('#myDiv').prepend('<p>Going up.</p>');
else
$('#myDiv').append('<p>Going down.</p>');
});
Obviously, evt.isGoingUp doesn’t actually exist. Is there anything that does exist that can accomplish this logic?
Hopefully this solution is useful for you… it will work on all elements with class name ‘scroll-track’. You must also provide a new attribute to the scrollable element:
data-scroll='{“x”:”0″, “y”:”0″}’
You can test it here: http://jsfiddle.net/CgZDD/
-js-