createScrollbarHelper
Namespaces
Functions
createScrollbarHelper()
createScrollbarHelper(
el
):ScrollbarHelper
创建元素滚动栏辅助工具
Parameters
Parameter | Type | Description |
---|---|---|
el | MaybeFn <Target > | 指定元素 |
Returns
Example
ts
const scrollbar = createScrollbarHelper(el)
scrollbar.getScrollLeft()
// => 0
// 实现自动滚动
setInterval(() => {
if (scrollbar.isReachBottom()) {
scrollbar.setScrollTop(0)
}
else {
scrollbar.addScrollTop(1)
}
}, 30)
Interfaces
ScrollbarHelper
Properties
Modifier | Property | Type | Description |
---|---|---|---|
public | addScrollLeft | (value ) => void | - |
public | addScrollTop | (value ) => void | - |
public | getScrollLeft | () => number | - |
public | getScrollTop | () => number | - |
public | isReachBottom | () => boolean | - |
public | isReachRight | () => boolean | - |
public | setScrollLeft | (value ) => void | - |
public | setScrollTop | (value ) => void | - |
readonly | target | Target | 目标元素 |