In my Angular 6 application i have a method which executes an auto scroll into the page. In Chrome it works fine, but in Internet Explorer (11) i get the following error:
ERROR TypeError: Object doesn't support property or method 'scrollTo'
This the function in my component:
autoScroll(step) {
setTimeout(() => {
let element = document.getElementById(step.stepId);
if (element) {
let el= document.getElementsByClassName("elements") && document.getElementsByClassName("elements")[0];
if (el) {
el.scrollTo({
top: 50,
behavior: "smooth"
});
}
}
})
}