Smooth Horizontal Scrolling with Mouse and TouchPad

I have been struggling to find a really smooth horizontal scrolling that works both with mouse for old PCs and with TrackPad of modern Laptops such as a Mac or even iPad, iPhone.

The best code that I could find around was from CSS-Tricks. But this didn’t work as smoothly as I hoped. While it worked for the mouse, which otherwise won’t scroll horizontally at all (just Vertical), it showed a jittery effect if we used the trackpads, especially when you were scrolling slowly.

Here is the code that I finally landed upon and it seems to work both with a mouse and with trackpads, no jittery effects at all. Its not yet smooth as you would scroll vertically, but it does the job well and better than the codes I used before.

You will need the mousewheel jQuery library which can be found here. And you can add this code in your script page.

I would love if anyone of you can improve upon this code and make it smoother. Hope it helps one of you out there. Thanks!