require : jquery mousewheel (https://github.com/brandonaaron/jquery-mousewheel)
var _MOUSEWHEEL_STEP = 20; $('SELECTOR').bind('mousewheel DOMMouseScroll', function(e) { var scrollTo = null; if (e.type === 'mousewheel') { scrollTo = (e.originalEvent.wheelDelta * -1); } else if (e.type === 'DOMMouseScroll') { scrollTo = _MOUSEWHEEL_STEP * e.originalEvent.detail; } if (scrollTo) { e.preventDefault(); $(this).scrollTop(scrollTo + $(this).scrollTop()); } });
ไม่มีความคิดเห็น:
แสดงความคิดเห็น