Catching Mouse Wheel Scroll inside Non-scrollable Div

Issue

Is there a way to catch the scroll event while mouse is positioned over a div that is not scrollable? My intent is to feign scrolling by adjusting top offset until div inside of div is above view then move top offset of inner div to below view of outer div. Kind of like a carousel, but vertical and controlled by scrolling of the mouse wheel. Obviously, to catch scroll events, I would use:

angular.element(elem).find('.divClass').bind('scroll', function(){...});

to handle scrolling that is actually occurring, but I’m interested in when the actual mouse wheel is scrolled much like a keybind.

Solution

you can use the onwheel event. see http://www.w3schools.com/jsref/event_onwheel.asp

some browsers use onmousehweel. for a good tutorial see https://www.sitepoint.com/html5-javascript-mouse-wheel/

Answered By – Woncker

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published