How to prevent user interaction interrupting JavaScript scroll(), scrollTo() or scrollIntoView()?

18 hours ago 1
ARTICLE AD BOX

I have a multi-section form. When the user clicks the Next button at the bottom of the page, my script uses a smooth scrollIntoView() to scroll up to the nav bar. When the scroll has completed, (by using this RAF technique) it executes a callback method that calls click() on the next nav link, which then shows the next section.

The problem I have is that if the user clicks anywhere on the page while the scroll is occurring, the scroll stops and my callback is never called. I have the same problem if the user moves his scroll wheel whilst the scroll is being performed.

Is there anyway to prevent the user interaction from stopping the scrollIntoView()? Or is there some other workaround?

NB - I also have this same problem with scroll() and scrollTo().

Read Entire Article