Rafff
Rafff

Reputation: 1518

Mousewheel horizontal scrolling

Referencing to the following example:

http://css-tricks.com/snippets/jquery/horz-scroll-with-mouse-wheel/

It does work under Chrome, but does not under Firefox.

In Firefox you can scroll only using arrow keys but not mousewheel.

Somebody know why this happens?

Upvotes: 3

Views: 8067

Answers (2)

Adam Swén
Adam Swén

Reputation: 41

I made a fiddle where you have a working example of a horizontal mouse scroll.

http://jsfiddle.net/ata68xr6/

using jquery.mousewheel.js and jquery with the function:

$(function() {
   $("html, body, *").mousewheel(function(event, delta) {
       this.scrollLeft -= (delta * 80);
       this.scrollRight -= (delta * 80);
       event.preventDefault();
   });
});

Upvotes: 4

Rick Hitchcock
Rick Hitchcock

Reputation: 35680

This was posted as a solution in the comments of the site you referenced:

$(function() {
        $("html, body").mousewheel(function(event, delta) {
            this.scrollLeft -= (delta * 30);
            event.preventDefault();
        });
    });

Upvotes: 2

Related Questions