Answers for "window.scrollTo"

2

js scrollto

element.scrollTo(x, y);
window.scrollTo(x, y);
element.scrollTo({
  top: 100,
  left: 100,
  behavior: 'smooth'
});
Posted by: Guest on July-09-2020
3

window.scroll

scroll function

window.scroll({
 top: 0, 
 left: 0, 
 behavior: 'smooth' 
});

window.scroll(x-coord, y-coord)
window.scroll(options)
Posted by: Guest on October-15-2020
1

window.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);
Posted by: Guest on June-18-2021
0

window.scrollto(0 0) not working

const scrollToTop = () => {
  document.getElementById("scroller").scroll(0,0)
}

<button onClick={scrollToTop}>Scroll to Top</button>
Posted by: Guest on December-13-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language