Just now, accidentally, i stumble upon http://www.benekdesign.com/ . 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.

刚才,我不小心偶然发现了http://www.benekdesign.com/。在鼠标滚轮上滚动它执行水平滚动。说真的,我不喜欢这个功能。这有点刺激。但是,请告诉我如何实现同样的目标。

Edited

编辑

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 - http://www.centralscrutinizer.it/en/design/js-php/horizontal-tiny-scrolling 4 v0.6 - February 14, 2007

/ *水平微小滚动 - 水平网站的平滑滚动脚本2(垂直“Tiny Scrolling”的兄弟)3 Marco Rosella - http://www.centralscrutinizer.it/en/design/js-php/horizo​​ntal-tiny - 滚动4 v0.6 - 2007年2月14日

3 个解决方案

#1


23

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:

看起来他只是将鼠标滚轮事件映射到滚动区域。在IE中,只需使用doScroll()方法就可以轻松实现 - 这将按垂直条通常滚动的数量滚动水平条。其他浏览器不支持doScroll()方法,因此您必须使用任意数量的滚动:

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

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

更多相关文章

  1. 如何检测jQuery中的水平滚动?
  2. 如何在Angular js制作水平手风琴?
  3. AngularJS ng-repeat项目水平到垂直
  4. 如何在当前视图中始终保持水平底部滚动条
  5. 嵌套水平滑块与单击控件
  6. Tkinter小部件上的垂直和水平滚动条
  7. SQL Server表中某些字段含有水平制表符、换行符、回车符、反斜杠
  8. Android SDK:RelativeLayout - 按钮不会水平居中,即使Layout_Cent
  9. 请问JAVA求职英语水平的要求

随机推荐

  1. C++实现贪吃蛇游戏的详细步骤及实战演示
  2. Thinking in C++ 第一卷阅读全书笔记重点
  3. C/C++区别有哪些?很多人都不知道的比较方
  4. 原来斐波拉契数列还有这种写法,你知道吗?
  5. C++_STL常用容器总结:对组pair中关联容器
  6. c/c++字符串函数是什么类型和它是如何转
  7. 详细介绍C# 中 ASP.NET Web API 的 ROC
  8. CSS选择器有哪些?CSS选择器优先级判定
  9. 必学!C++实现多态机制满足的基本条件条件
  10. 最新总结C语言中关于指针等相关理解和使