overscroll
Version:
39 lines (29 loc) • 790 B
JavaScript
import { set } from './utils/css';
export default function (scope) {
var target = scope.target,
axis = scope.axis,
hasX = scope.hasX,
hasY = scope.hasY,
setData = scope.domData.setData,
OVERSCROLL = scope.OVERSCROLL,
OVERSCROLLX = scope.OVERSCROLLX,
OVERSCROLLY = scope.OVERSCROLLY,
BUBBLE = scope.BUBBLE,
NOBUBBLE = scope.NOBUBBLE,
bubble = scope.bubble,
resetCache = scope.resetCache;
// 添加样式
set(target, 'overflow', 'hidden');
// DOM 打上标记
setData(target, OVERSCROLL);
if (hasX(axis)) {
setData(target, OVERSCROLLX);
}
if (hasY(axis)) {
setData(target, OVERSCROLLY);
}
setData(target, bubble ? BUBBLE : NOBUBBLE);
// 初始化缓存
resetCache();
return scope;
}