admin管理员组

文章数量:1356734

Referencing to the following example:

/

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?

Referencing to the following example:

http://css-tricks./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?

Share Improve this question asked Aug 10, 2014 at 11:30 RafffRafff 1,5163 gold badges20 silver badges38 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 4

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

http://jsfiddle/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();
   });
});

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

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

本文标签: javascriptMousewheel horizontal scrollingStack Overflow