mousewheel

Get mouse wheel events in jQuery?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-26 01:27:19
问题 Is there a way to get the mouse wheel events (not talking about scroll events) in jQuery? 回答1: There's a plugin that detects up/down mouse wheel and velocity over a region. 回答2: ​$(document).ready(function(){ $('#foo').bind('mousewheel', function(e){ if(e.originalEvent.wheelDelta /120 > 0) { console.log('scrolling up !'); } else{ console.log('scrolling down !'); } }); }); 回答3: Binding to both mousewheel and DOMMouseScroll ended up working really well for me: $(window).bind('mousewheel