跳过主要内容

.smooth

.smooth( duration:Number ) : Number | self

获取/设置追赶滚动位置所需的时间(即平滑度)。

参数

  • 持续时间: 数值

    平滑滚动“追上”原生滚动位置所需的秒数。

返回值:Number(数字) | self(自身)

追赶至滚动位置所需的时间(以秒为单位),当作为getter使用时返回此数值,作为setter使用时返回ScrollSmoother实例本身,便于链式调用。

细节

获取/设置追赶滚动位置所需的时间(即平滑度)。

// setter
smoother.smooth(1.5);

// getter
let duration = smoother.smooth();