I would like a slider to change slides by using the mousewheel with jquery. Which command is responsible for when the mousewheel triggers? I would like the slide to change once you slightly use the wheel, not after scrolling for some time.
Asked
Active
Viewed 132 times
0
-
there is a link related with that try to check this :) https://stackoverflow.com/questions/9404406/trigger-dummy-mouse-wheel-event – Joe Lorthemier Rauzes Mar 24 '19 at 19:09
1 Answers
0
The onwheel
event can be used:
<element onwheel="myScript">
or
document.getElementById("myDIV").addEventListener("wheel", myFunction);
function myFunction(event) {
console.log(event);
}
You can do this with jquery:
$("#myDIV").on({
wheel: function(event){
console.log(event.originalEvent.deltaY);
}
});
The event object contains the following data:
deltaX: Returns the horizontal scroll amount of a mouse wheel (x-axis)
deltaY: Returns the vertical scroll amount of a mouse wheel (y-axis)
deltaZ: Returns the scroll amount of a mouse wheel for the z-axis
deltaMode: Returns a number that represents the unit of measurements for delta values (pixels, lines or pages)
For example you can call event.deltaY
to get the amount of scrolling in Y direction

maanijou
- 1,067
- 1
- 14
- 23
-
Hey thanks for the response, now I get what is responsible for the trigger. So if a i have a code like this: `wheelDeltaY&&(g=c.wheelDellDeltaY/120)` Do you know what I would have to change so it is triggering earlier? – Nick M Mar 24 '19 at 19:38
-
I don't understand what you mean. Is this a separate question? What should be triggered earlier? The intention of the code is not clear. – maanijou Mar 24 '19 at 19:46
-
Oh okay. It is related to my problem, since I have a wordpress theme with a fullpage vertical scroll integrated, it works fine, but it triggers the next slide quite late. Found that snippet in the js file, was wondering if it had anything to do with it. Sorry I have no clue about js/jquery, thought there mightve been an easy way to fix this. – Nick M Mar 24 '19 at 19:53
-
NP. I think that's another question. You must refer to your theme provider. Here is a link that i found that might help you with that issue: http://para.llel.us/support/tutorials/linking-menu-items-to-sections-on-the-same-page/ You can have a separate question, concerning that problem if the link didn't work for you. – maanijou Mar 24 '19 at 20:00
-