问题
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 outter 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.
回答1:
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/
来源:https://stackoverflow.com/questions/40107394/catching-mouse-wheel-scroll-inside-non-scrollable-div