I have the following code in the head-section:
<script type='text/javascript' src='/js/jquery.mousewheel.min.js'></script>
jQuery(function($) {
$('#box').bind('mousewheel', function(event, delta) {
var dir = delta > 0 ? 'Up' : 'Down',
vel = Math.abs(delta);
alert(dir + ' at a velocity of ' + vel);
return false;
});
});
In firefox 5 nothing happens at all. In Chrome 13 and IE 9 I get “Down at a velocity of NaN”, no matter at which direction I scroll.
How can I fix this? What I want to do is to check if the user is scorlliing upwards, or if he´s scrolling downwards.
Thanks for your help!
It means that
deltais undefined which probably means you didn’t include the proper plugin, or included it in the wrong place.Don’t know what you download, I’ve tried now with this and it’s working fine.
If you remove the external resource, it won’t work as happens in your case.