Friday, May 10, 2024
100
rated 0 times [  103] [ 3]  / answers: 1 / hits: 15297  / 6 Years ago, wed, july 25, 2018, 12:00:00

I use scroll in my method



const scrollToCenter = () => {
const kon = document.querySelector('.clazz');
const width = kon.offsetWidth;
kon.scrollTo(width / 2, 0);
};


and it works fine in Chrome and Mozilla. In the Edge I'd got an error Object doesn't support property or method scrollTo.
Is exist any different method to use it in Edge?


More From » microsoft-edge

 Answers
12

The official report :
https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/15534521/



The issue has been assigned to someone.



Following the comments the workaround is




.scrollTop = 0 instead of .scrollTo(0,0) In case you want to scroll somewhere else than top i haven’t found a workaround


[#53888] Monday, July 23, 2018, 6 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rayvenc

Total Points: 666
Total Questions: 125
Total Answers: 99

Location: Northern Ireland
Member since Mon, Nov 14, 2022
2 Years ago
;