jquery水平滚动鼠标滚轮 [英] jquery horizontal scroll with mousewheel

查看:42
本文介绍了jquery水平滚动鼠标滚轮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前有一个网站是侧向卷轴(http://www.studioimbrue.com)和我正在尝试绑定鼠标滚轮以横向滚动.目前我正在使用在 thehorizo​​ntalway.com 上找到的那个(称为 thw.js),但它似乎不适用于所有浏览器(Chrome).

I currently have a site that is a sidescroller (http://www.studioimbrue.com) and I'm trying to bind a mousewheel to scroll sideways. Currently I'm using the one found at thehorizontalway.com (called thw.js) but it doesn't seem to work in all browsers (Chrome).

我正在努力让这个工作:http://brandonaaron.net/code/mousewheel/docs ,只是滚动整个窗口,没有别的.文档非常有限,所以我无法弄清楚.任何帮助表示赞赏.

I'm trying to get this one to work: http://brandonaaron.net/code/mousewheel/docs , to simply scroll the whole window, nothing else. There is very limited documentation so I can't figure it out. Any help is appreciated.

推荐答案

我刚刚回答了这个问题关于水平滚动 div,我还包含了一些代码来使用鼠标滚轮或者只是用鼠标抓取和拖动......也许其中一些代码会给你一个想法?

I just answered this question about scrolling a div horizontally, I also included some code to use the mousewheel or just grab and drag with the mouse... maybe some of that code will give you an idea?

详细说明一下,鼠标滚轮函数为您提供事件对象和增量.

To elaborate a bit, the mousewheel function gives you the event object and the delta.

$('#container').bind('mousewheel', function(event,delta){
 if (delta > 0) {
   // mousewheel is going up; 
 } else {
   // mousewheel is going down 
 }
});

delta 的值取决于您滚动滚轮的速度.如果你真的很努力,我已经看到了从 +50 到 -50 的范围:P

The value of delta depends on how fast you scroll the wheel. I've seen a range from +50 to -50 if you try really hard :P

这篇关于jquery水平滚动鼠标滚轮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆