Do more on the web, with a fast and secure browser!

Download Opera browser with:

  • built-in ad blocker
  • battery saver
  • free VPN
Download Opera

First extension

  • Hi!

    I'm trying to create my first extension which allows me to toggle automatic down scrolling with a keyboard shortcut.
    I already managed to make an extension which does something when I press the key combination, but I don't know how to control the scrolling process. Which API do I use? I already looked through the APIs but couldn't find the right one.

    If someone knows, please tell me. 😃

    Regards

  • Extension is basically javascript - search for suitable javascript sample and include that into your extension.

  • First of all, thanks for your answer!

    The method I want to use would be the window.scrollBy(x,y) method, but I'm still having trouble implementing it.

    My background script code:

    chrome.commands.onCommand.addListener(function ScrollDown(command){ if(command == "scroll") {
    window.scrollBy(0,150);
    alert("You tried to scroll! :)"); }})

    The alert works just fine when pressing the key combination, but it won't scroll down.

Locked