Skip to content

Instantly share code, notes, and snippets.

@chrishutchinson
Created October 13, 2018 20:24
Show Gist options
  • Save chrishutchinson/14c0bb49c17a45cd565d1aa2089e9ea8 to your computer and use it in GitHub Desktop.
Save chrishutchinson/14c0bb49c17a45cd565d1aa2089e9ea8 to your computer and use it in GitHub Desktop.
Hacking with JavaScript and Shortcuts (#2)
const handleOrientation = event => {
const x = event.beta;
if (x < 40 && x > 20) return;
if (x > 40 && x <= 60) {
window.scrollBy(0, 1);
} else if (x > 60) {
window.scrollBy(0, 2);
} else {
window.scrollBy(0, -1);
}
};
window.addEventListener("deviceorientation", handleOrientation);
completion();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment