How to do a horizontal scroll on mouse wheel scroll?

Just now, accidentally, i stumble upon . Here on mouse wheel scroll it performs horizontal scroll. Truly speaking i didn't like this feature. It was a bit irritating. But still, Please tell me how to achieve the same.


Okay, firebug says he is using

/* Horizontal Tiny Scrolling - a smooth scrolling script for horizontal websites 2(the brother of the vertical "Tiny Scrolling") 3by Marco Rosella - 4 v0.6 - February 14, 2007



It looks like he's just mapping the mousewheel event to scrolling the area. In IE, this is really easy by just using the doScroll() method - this will scroll the horizontal bar by the amount the vertical bar would normally scroll by. Other browsers don't support the doScroll() method, so you have to live with scrolling by an arbitrary amount instead:

var mouseWheelEvt = function (event) {
    if (document.body.doScroll)
    else if ((event.wheelDelta || event.detail) > 0)
        document.body.scrollLeft -= 10;
        document.body.scrollLeft += 10;

    return false;
document.body.addEventListener("mousewheel", mouseWheelEvt);

As the solutions above does not work for me, here another one i just found:



Another form:

document.addEventListener('wheel', (e) => {
    document.getElementById('scroll_container').scrollLeft += e.deltaY;


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us Javascript

©2020 All rights reserved.