Questions tagged [js-scrollto]

The Window.scrollTo() method scrolls to a particular set of coordinates in the document.

The Window.scrollTo() and Window.scroll() methods scroll to a particular set of coordinates in the document.

Syntax

window.scrollTo(x-coord, y-coord)
window.scrollTo(options)
window.scroll(x-coord, y-coord)
window.scroll(options)

Parameters

  • x-coord is the pixel along the horizontal axis of the document that you want displayed in the upper left.
  • y-coord is the pixel along the vertical axis of the document that you want displayed in the upper left.
  • options is a ScrollToOptions dictionary.

Examples

window.scrollTo(0, 1000);
window.scrollTo(0, -1000);
window.scroll(0, 1000);
window.scroll(0, -1000);

Reference

18 questions
0
votes
0 answers

How to scroll to a component in Next.js?

I am a little confused, my navbar is a component as are my other sections. How do i add a scrollToView on it. I don't understand where the function goes. Can somebody help me ? I tried using useRef and another npm package. And, it didn't work. Here…
someone
  • 661
  • 1
  • 9
  • 26
0
votes
1 answer

Blazor: How to scroll to first error in edit form?

I have an editform with a large number of fields. If the user makes an error and attempts to submit the form, they must scroll manually to see the errors. With javascript, something like this could be done: var element =…
Mr.Technician
  • 301
  • 5
  • 15
0
votes
2 answers

The method executeScript(String, Object[]) in the type JavascriptExecutor is not applicable for the arguments (String, WebElement) error with Selenium

Below is the code: JavascriptExecutor jse = (JavascriptExecutor)driver; WebElement blueray = driver.findElement(By.xpath("Xpath ID")]")); jse.executeScript("scroll(0,250)", blueray); Below is the error: The method executeScript(String, Object[]) in…
1
2