okno.prejdite
scroll function
window.scroll({
top: 0,
left: 0,
behavior: 'smooth'
});
window.scroll(x-coord, y-coord)
window.scroll(options)
js scrollto
element.scrollTo(x, y);
window.scrollTo(x, y);
element.scrollTo({
top: 100,
left: 100,
behavior: 'smooth'
});
okno.scrollTo
//scrolls to horizontal position 500
window.scrollTo(500, 0);
//scrolls to vertical position 500
window.scrollTo(0, 500);
// scrolls to bottom of page
window.scrollTo(0, document.body.scrollHeight);
okno.scrollto (0 0) nefunguje
const scrollToTop = () => {
document.getElementById("scroller").scroll(0,0)
}
<button onClick={scrollToTop}>Scroll to Top</button>