Skip to content

Instantly share code, notes, and snippets.

@matori
Last active March 15, 2019 07:16
Show Gist options
  • Save matori/0d90a0430544744ef5edba7b9821d755 to your computer and use it in GitHub Desktop.
Save matori/0d90a0430544744ef5edba7b9821d755 to your computer and use it in GitHub Desktop.
function noScrollFocus(element) {
const x = window.scrollX || window.pageXOffset;
const y = window.scrollY || window.pageYOffset;
element.focus();
window.scrollTo(x, y);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment