Created
February 19, 2018 12:06
-
-
Save aslakhellesoy/ddf32842f03efbb46d0102588b699264 to your computer and use it in GitHub Desktop.
dictation scroller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
pre { | |
white-space: pre-wrap; | |
font-size: 60px; | |
font-family: serif; | |
height: 100%; | |
padding: 10px; | |
} | |
</style> | |
</head> | |
<body> | |
<pre> | |
For my first webinar I had a lot of talking to do into the camera, and I wanted to be able to read off a slowly scrolling | |
page like people on TV did in the old days. | |
This script scrolls the page smoothly by pressing Up/Down keys, and can be used with typical remotes for powerpoint/keynote. | |
Every time Up/Down is pressed it scrolls a little faster, and changing direction stops scrolling immediately. | |
</pre> | |
<script> | |
var inc = 0 | |
setInterval(function() { | |
window.scrollBy(0, inc) | |
}, 30) | |
document.addEventListener('keydown', (event) => { | |
if(event.key == 'ArrowDown') { | |
if(inc < 0) | |
inc = 0 | |
else | |
inc++ | |
} | |
if(event.key == 'ArrowUp') { | |
if(inc > 0) | |
inc = 0 | |
else | |
inc-- | |
} | |
}) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment