1

I'm trying to change React app in IE window.scrollTo() behavior like chrome does. In chrome we are instantly jump to the x & y, but in IE we are forced to scroll to x & y. I've tried disabling smooth scrolling and it works well, but the overall scrolling experience sucks (looks like laggy). Can you help me to solve this problem? Thanks!

Riven
  • 536
  • 1
  • 5
  • 17
  • 1
    You can use `window.scrollTo(0, 100, { behaviour: 'smooth' })` – ChrKahl Feb 08 '19 at 10:58
  • @ChrKahl it doesn't work sorry, because IE11 doesn't support scrollTo params, as stated in https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo – Riven Feb 08 '19 at 11:01
  • I tried to create a sample with [window.scrollTo()](https://www.w3schools.com/jsref/met_win_scrollto.asp) function it seems that the behavior in chrome and IE browser are the same. I suggest you could post the Enough code to reproduce the problem as in [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). And, you could also refer to [this thread](https://stackoverflow.com/questions/43441856/reactjs-how-to-scroll-to-an-element) and [this article](https://reactjsexample.com/scroll-to-a-position-in-react/) to scroll to a position. – Zhi Lv Feb 11 '19 at 05:52
  • maybe look into this npm package: https://github.com/iamdustan/smoothscroll this allows you to do the same as @ChrKahl stated. Just polyfilled :) does this help you? – r3dst0rm Mar 07 '19 at 15:48

0 Answers0