滑动scroll没有效果

scroll左滑动或者上滑的时候,点击之后没有效果。

document.getElementById('scroll').scrollLeft = 100;

此时应该没有渲染或者没有拿到dom,此时可以使用setTimeout延时器来解决。

setTimeout(() => {
    document.getElementById('scroll').scrollLeft = totalLen;
}, 0);
原文地址:https://www.cnblogs.com/liumcb/p/14741648.html