xxm-test-js
Version:
xxm-js通用js工具(utils)库
20 lines (19 loc) • 794 B
TypeScript
/**
* 用于检测页面滚动方向的工具类。
* 该类提供了一个静态方法来获取当前的滚动方向,不包含事件监听,需要时手动调用。
*
* @returns {'up' | 'down' | 'top' | 'bottom'} 当前的滚动方向,可能的值为 'up'(向上滚动)、'down'(向下滚动)、'top'(页面顶部)、'bottom'(页面底部)。
* @example
* ```javascript
* const direction = ScrollDirectionChecker.getDirection();
* console.log('当前滚动方向:', direction);
* ```
*/
declare class ScrollDirectionChecker {
private static config;
private static getScrollPosition;
private static lastScrollPosition;
private static lastDirection;
static getDirection(): 'up' | 'down' | 'top' | 'bottom';
}
export { ScrollDirectionChecker };