最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Mousewheel horizontal scrolling - Stack Overflow

programmeradmin0浏览0评论

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();
        });
    });
发布评论

评论列表(0)

  1. 暂无评论