Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Firefox PDF.js reader autoscroll shorcuts
// use the s shortcut to toggle autoscroll
var as; document.onkeyup = function(e) {
if(e.key == "s"){
if (!as) {
as = setInterval( () => { document.querySelector("#viewerContainer").scrollBy(0, 1) } , 100 );
// for a normal page use window.scrollBy instead
} else {
clearInterval(as); as = null; scrolling = false;
}
}
}
// example GIF https://twitter.com/utopiah/status/1101890549504724993
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment