(function ($) {
var mouseScroll = function (e) {
try {
var origEvent = e.originalEvent;
origEvent.preventDefault();
} catch (err) {
}
};
var mouseWheel = function (e) {
try {
e = e || window.event;
e.preventDefault();
e.returnValue = false;
} catch (err) {
}
};
$.fn.preventOuterScroll = function () {
var element = this.get(0);
if (navigator.userAgent.toLowerCase().indexOf("firefox") > -1) {
this.on("DOMMouseScroll", function (e) {
var origEvent = e.originalEvent;
element.scrollTop += origEvent.detail > 0 ? 60 : -60;
origEvent.preventDefault();
});
} else {
element.onmousewheel = function (e) {
e = e || window.event;
element.scrollTop += e.wheelDelta > 0 ? -60 : 60;
e.preventDefault();
e.returnValue = false;
};
}
return this;
};
$.fn.preventScroll = function () {
var element = this.get(0);
if (navigator.userAgent.toLowerCase().indexOf("firefox") > -1) {
this.on("DOMMouseScroll", mouseScroll);
} else {
$(element).on("mousewheel", mouseWheel);
}
return this;
};
$.fn.liveScroll = function() {
var element = this.get(0);
if (navigator.userAgent.toLowerCase().indexOf("firefox") > -1) {
this.off("DOMMouseScroll", mouseScroll);
} else {
$(element).off("mousewheel", mouseWheel);
}
return this;
};
}($));

scrollHelper的更多相关文章

  1. XtraScrollableControl 滚动条控件随鼠标滚动

    using System; using System.Windows.Forms; using DevExpress.XtraEditors; namespace WindowsFormsApplic ...

  2. xtraScrollableControl 滚动条随鼠标滚动

    代码如下 // using System; using System.Windows.Forms; using DevExpress.XtraEditors; namespace WindowsFor ...

  3. DialogHelper

    //require ScrollHelper.js function DialogHelper() { var _this = this; var doc = window.document; _th ...

随机推荐

  1. AtCoder AGC #4 Virtual Participation

    我好懒啊QAQ 老规矩 从C开始 C.给一个矩阵,里面有一些紫色方块,你需要涂两个矩阵,一个红色,一个蓝色,保证你涂的颜色四连通 然后把红色蓝色矩阵叠起来要求紫色的地方必须是紫色,其他地方不能是紫色 ...

  2. POJ2763 Housewife Wind(树剖+线段树)

    After their royal wedding, Jiajia and Wind hid away in XX Village, to enjoy their ordinary happy lif ...

  3. 1123 Is It a Complete AVL Tree(30 分)

    An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child sub ...

  4. Day07:常用模块,面向对象编程(对象&类)及内置函数

    今日内容:1.常用模块2.面向对象编程(*****)    介绍面向对象编程    类    对象3.内置函数------------------------------1.面向过程编程    核心“ ...

  5. docker学习 (二)基本概念

    基本概念: Docker包括三个基本概念: 镜像(Image): 特殊的文件系统,提供容器运行时所需的程序.库.资源.配置文件.镜像不包含动态数据,内容在构建后不会被改变. 容器(Container) ...

  6. Altium Designer如何从已有的PCB图中导出封装库

    1.打开PCB文件 2.选择  Design -> Make Integrated Library  (生成集成库) 注意,一定要在PCB 文件下  生成集成库!! 最终生成这个文件,打开这个文 ...

  7. Java关键字以及一些基础解释

    Java Se:Java Me 和Java Ee的基础,允许开发和部署在桌面,服务器,嵌入式环境和实时环境中使用的java程序,支持java web服务开发类 java ee:是目前java技术应用最 ...

  8. java---集合类(1)

    java.util包中包含了一系列重要的集合类.而对于集合类,主要需要掌握的就是它的内部结构,以及遍历集合的迭代模式. 接口:Collection Collection是最基本的集合接口,一个Coll ...

  9. Python list的定义和删改

    需要用到list.取回参数 .  sys.argv返回的是个元组. 最后发现用for循环好像没用. a=0 for i in sys.argv[1:]: qh[a]=sys.argv[a] a=a+1 ...

  10. 微信小程序开发之下拉菜单

    实现功能:点击维保人员,调出下拉菜单.选择子菜单时,显示右边的图标表示选中,并进行赋值并进行搜索筛选 Wxml: <view class="dtclass" bindtap= ...