当滚动距离大于200的时候,可以向左滚动,禁止继续向右滚动?-灵析社区

一本正经写代码

const Scroll = (e) => { const left = ScrollBox.value?.scrollLeft; if (left > 200) { //禁止继续向右滚动 } } 当滚动距离大于200的时候,禁止继续向右滚动 //禁止继续向右滚动 这里怎么写呢?

阅读量:194

点赞量:14

问AI
const Scroll = (e) => { const ScrollBox = e.target; const left = ScrollBox.scrollLeft; if (left > 200) { ScrollBox.scrollLeft = 200; } }