Smooth Scroll Using window.scrollBy

Rather than window.scrollBy you can use window.scroll.

http://jsfiddle.net/peterdotjs/f7yzLzyx/1/

var x = 1; //y-axis pixel displacement
var y = 1; //delay in milliseconds

setInterval(function() {
    window.scroll(0, x);
    x = x + 5; //if you want to increase speed simply increase increment interval
}, y);

As you currently have y value set very low, you can adjust the values of y and the incremental value of x to find the desired scroll speed.


You can also scroll other elements:

document.querySelector('.el-class').scrollBy({
  top: 100,
  behavior: 'smooth',
});

Use behavior option instead of setInterval its more simple and it's the right way to do this,

var x = 1;
var y = 1;

window.scrollBy({
    top: x,
    left: y,
    behavior : "smooth"
})