p1llar
2018-09-20 20:04:40 +08:00
onwheel 事件了解一下,下面是从那个网站 copy 过来的
```
wheelEvent && isChrome && isSmoothScrollActive && (addEvent(wheelEvent, function(event) {
initDone || init();
var target = event.target
, overflowing = overflowingAncestor(target);
if (!overflowing || event.defaultPrevented || isNodeName(activeElement, "embed") || isNodeName(target, "embed") && /\.pdf/i.test(target.src))
return !0;
var deltaX = event.wheelDeltaX || 0
, deltaY = event.wheelDeltaY || 0;
if (deltaX || deltaY || (deltaY = event.wheelDelta || 0),
!options.touchpadSupport && isTouchpad(deltaY))
return !0;
Math.abs(deltaX) > 1.2 && (deltaX *= options.stepSize / 120),
Math.abs(deltaY) > 1.2 && (deltaY *= options.stepSize / 120),
scrollArray(overflowing, -deltaX, -deltaY),
event.preventDefault()
}),
```