Is there a way to make horizontal scrolling smoother

horizontal-scrolling, javascript

Solution

This could probably be optimised a fair bit, but here is a basic example of how you could do it using `setInterval` and `clearInterval`

Fiddle

Update

Here is another example of it wrapped into a function instead, bit easier to tweak the speed etc.

Fiddle

Problem

This fiddle is almost what I'm looking for, I got it from MDN. The only thing missing is that I want to make it smoother. Is there a way to do that without using jQuery or any other plugins? Fiddle ``` var button = document.getElementById('slide'); button.onclick = function () { document.getElementById('container').scrollLeft += 100; }; var back = document.getElementById('slideBack'); back.onclick = function () { document.getElementById('container').scrollLeft -= 100; }; ```

Original source