Jquery mousewheel detect scroll position works not correctly
<p>Hi I do some js part on my website and have problem with mousewhell scroll.</p>

<p>This is my code how I detect scroll up or down.</p>

<pre><code>$(window).on({
    'mousewheel': function (e) {
        e.preventDefault();
        e.stopPropagation();
    }
});


$(window).on('mousewheel DOMMouseScroll', function (event) {
    event.preventDefault();
    var delta = event.originalEvent.wheelDelta || -event.originalEvent.detail;

    if(delta &gt; 0) {
        //up
    }else {
        //down
    }
});
</code></pre>

<p>I don't understand what is wrong. It works like random I scroll down it goes up or I scroll up it's go down or it's work normally. Can I detect position with other solution without plugin. It also work crazy when I scroll it with touchpad not mouse scroll</p>

<p>Thanks for you time</p>