React:如何在使用React滚动时禁用点击



在滚动动画过程中单击屏幕上的任何位置时,动画都会停止。我想禁用它,并认为其中一种方法是在滚动过程中使整个屏幕不可点击。我试着制作指针事件:在Scroll上没有,但没有成功。有什么解决方案吗?

使用ignoreCancelEvents属性:

<Link 
activeClass="active" 
to="secondInsideContainer" 
spy={true} 
smooth={true} 
duration={9250}  
ignoreCancelEvents={true} // <----- Add this line
containerId="containerElement" 
>
Go to second element inside container
</Link>

最新更新