Autify JavaScript Snippets
Toggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto mode Back to homepage
Edit page

Scroll until an element is visible

IE11 not supported
This snippet does not support IE11.

Scroll to a specified element in the entire page.

 * Locate the element
var selector = "<TODO: REPLACE SELECTOR>";
var element = document.querySelector(selector);

 * Stop process if it does not exist
if (!element) {
  throw new Error(
    "Error: cannot find the element with selector(" + selector + ")."

 * Scroll to the bottom of the element