This is 2017 and the right answer is now:
$(window).on('wheel', function(event){
// deltaY obviously records vertical scroll, deltaX and deltaZ exist too
if(event.originalEvent.deltaY < 0){
// wheeled up
}
else {
// wheeled down
}
});
Works with current Firefox 51, Chrome 56, IE9+
Note: The value of the deltas will depend on the browser and the user settings.
Related Contents:
- How to simulate a click by using x,y coordinates in JavaScript?
- How to completely DISABLE any MOUSE CLICK
- Using mousedown event on mobile without jQuery mobile?
- How to check if element is visible after scrolling?
- Convert form data to JavaScript object with jQuery
- Detect browser or tab closing
- jqgrid server side error message/validation handling
- JavaScript/JQuery: $(window).resize how to fire AFTER the resize is completed?
- Access Control Request Headers, is added to header in AJAX request with jQuery
- Detect viewport orientation, if orientation is Portrait display alert message advising user of instructions
- How can I custom-format the Autocomplete plug-in results?
- Refresh/reload the content in Div using jquery/ajax
- How do I check if an HTML element is empty using jQuery?
- How to send a JSON object using html form data
- What is the cleanest way to get the progress of JQuery ajax request?
- Set Additional Data to highcharts series
- ReferenceError: event is not defined error in Firefox
- How to scroll to specific item using jQuery?
- Get the contents of a table row with a button click
- How can I remove a style added with .css() function?
- How to detect escape key press with pure JS or jQuery?
- Removing or replacing a stylesheet (a ) with JavaScript/jQuery
- How do I edit a CSS variable using JS?
- event.wheelDelta returns undefined
- Modifying CSS class property values on the fly with JavaScript / jQuery
- How to close an open collapsed navbar when clicking outside of the navbar element in Bootstrap 3?
- How can I detect whether an iframe is loaded?
- Creating a jQuery object from a big HTML-string
- How to get all of the IDs with jQuery?
- How to prevent simultaneous logins of the same user with Firebase?
- Rails 5: how to use $(document).ready() with turbo-links
- Setting CSS value limits of the window scrolling animation
- How can val() return Number?
- How to handle floats and decimal separators with html5 input type number
- Open a new javascript window(.open) along with its CSS styling
- How can I find the length of a number?
- How to ONLY trigger parent click event when a child is clicked
- RGB to HSV color in javascript? [closed]
- How to disable submit button once it has been clicked?
- Best way to convert string to array of object in javascript?
- Google Maps Display:None Problem
- sort JSON by date
- Open Select using Javascript/jQuery?
- Insert dash after every 4th character in input
- Change iframe src by clicking a link
- Event capturing jQuery
- jQuery(#id).val() vs. getElementById(#id).value
- How to create rounded bars for Bar Chart.js v2?
- How do I make an area unclickable with CSS?
- jQuery Autocompletion with Eclipse Juno Java EE