Skip to content

Instantly share code, notes, and snippets.

@Utopiah
Last active October 9, 2023 13:35
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Utopiah/d0094c8f90efdb7320bb41c3e01ce62a to your computer and use it in GitHub Desktop.
Save Utopiah/d0094c8f90efdb7320bb41c3e01ce62a to your computer and use it in GitHub Desktop.
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