2

The emerging Web 2.0 trend of floating headers makes scrolling by space key not work correctly: when you hit space, if the header is high enough, it obscures some content and you have to nudge the page a little bit back up to see everything.

Some websites are aware of that and have custom space scrolling, that advances the view not by the usual ~95% of the page height, but by a smaller amount. But many do not.

I am looking for a way to change the amount of scroll on space key, with the ability to turn it on and off on different domains. I’m using Chrome, but I’m not bound to it and can change to Firefox.

2 Answers 2

1

Scroll Half Page

This Chrome extension does most of what you want, in that it allows you to reduce the scroll length (to half a page).

But, it does not allow you to specify which sites to use the different length on.

However, you can use the alternate hotkey Ctrl +Space it provides to scroll half a page, and use that hotkey on the pages you want to scroll smaller amounts by :)

Its settings:

Scroll Half Page Options, for 'Space' and 'Ctrl + Space'

0

That browser extension doesn't work for me. I just run the following JS code in console.

(function() {

  var currentScroll = window.scrollY;

  var runOnScroll =  function(evt) { 
    console.log(window.scrollY, currentScroll);
    currentScroll = (currentScroll + window.scrollY) / 2;
 
    window.scrollTo(window.scrollX, currentScroll);
  };

  const debounce = (callback, wait) => {
    let timeoutId = null;
    return (...args) => {
      window.clearTimeout(timeoutId);
      timeoutId = window.setTimeout(() => {
        callback.apply(null, args);
      }, wait);
    };
  }

  window.addEventListener("scroll", debounce(runOnScroll, 20), {passive: true});
})();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.