Skip to content

createScrollbarHelper

Namespaces

Functions

createScrollbarHelper()

createScrollbarHelper(el): ScrollbarHelper

创建元素滚动栏辅助工具

Parameters

ParameterTypeDescription
elMaybeFn<Target>指定元素

Returns

ScrollbarHelper

Example

ts
const scrollbar = createScrollbarHelper(el)

scrollbar.getScrollLeft()
// => 0

// 实现自动滚动
setInterval(() => {
  if (scrollbar.isReachBottom()) {
    scrollbar.setScrollTop(0)
  }
  else {
    scrollbar.addScrollTop(1)
  }
}, 30)

Interfaces

ScrollbarHelper

Properties

ModifierPropertyTypeDescription
publicaddScrollLeft(value) => void-
publicaddScrollTop(value) => void-
publicgetScrollLeft() => number-
publicgetScrollTop() => number-
publicisReachBottom() => boolean-
publicisReachRight() => boolean-
publicsetScrollLeft(value) => void-
publicsetScrollTop(value) => void-
readonlytargetTarget目标元素