Open moehammoud opened 7 years ago
+1 I have the same issue.
Probably the "future-proof" fix could be using document.scrollingElement
.
Currently it works fine in every modern desktop browser (but it's NOT supported in IE <= 11).
For more details take a look to the related browser compatibility table on MDN.
So it seems that using the element
document.body
no longer works on Chrome and Firefox. It still works just fine on Safari and IE. The fix for Chrome seems to be usingdocument.documentElement
instead ofdocument.body
. The issue now is that the fix no longer works in Safari. I can include a simpleif else
statement to ensure each browser has a validanimatedScrollTo
function called, but I wonder if there is a more elegant solution that could be used or included in the animatedScrollTo library.Example of my animateScrollTo call after syntax change.