Joni
Joni

Reputation: 91

React: How to disable clicking while scrolling with react-scroll?

When I click anywhere on the screen during a scroll animation the animation stops. I want to disable this and figured one of the ways would be to make the whole screen unclickable during the scroll. I tried making pointer-events: none onScroll but it didn't work. Any solutions?

Upvotes: 0

Views: 653

Answers (1)

Babak Yaghoobi
Babak Yaghoobi

Reputation: 1985

use ignoreCancelEvents property:

<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>

Upvotes: 2

Related Questions