I want to scroll the content of a div with the mousewheel jquery plugin. I have this but its not working. Any thoughts?
$(function() {
$('#contentBox').bind('mousewheel', function(event, delta) {
if (delta > 0) {
$('#contentBox').css('top', parseInt($('#contentBox').css('top'))+40);
} else {
$('#contentBox').css('top', parseInt($('#contentBox').css('top'))-40);
}
return false;
});
});
$('#contentBox').bind('mousewheel DOMMouseScroll', function(event) {
event.preventDefault();
var delta = event.wheelDelta || -event.detail;
$(this).css({'top': $(this).position().top + (delta > 0 ? '+=40' : '-=40')});
});