DEV Community

Shunsuke Nishino
Shunsuke Nishino

Posted on

Does Chrome for iPhone have window.scrollTo?

I tried window.scrollTo([0, 1000]) but Always back to top.

Another one tried window.scroll([0, 1000]).
scroll is keeping.

I wanted it.

Why window.scrollTo?

Top comments (3)

Collapse
 
nektro profile image
Meghan (she/her)

The issue you may be running into is that both scroll and scrollTo take an x-coord and a y-coord independently, not an Array.

window.scrollTo([0,100]); // bad

window.scrollTo(0, 100); // good
window.scrollTo(...[0,100]); // good
Collapse
 
andy profile image
Andy Zhao (he/him)

Nice, I tried to figure this out but I got caught up in the syntax, too.

Collapse
 
shsssskn profile image
Shunsuke Nishino

I see... I I misunderstood.

Thank you.