scrollHelper

 1 (function ($) {
 2     var mouseScroll = function (e) {
 3         try {
 4             var origEvent = e.originalEvent;
 5             origEvent.preventDefault();
 6         } catch (err) {
 7         }
 8     };
 9     var mouseWheel = function (e) {
10         try {
11             e = e || window.event;
12             e.preventDefault();
13             e.returnValue = false;
14         } catch (err) {
15         }
16     };
17     $.fn.preventOuterScroll = function () {
18         var element = this.get(0);
19         if (navigator.userAgent.toLowerCase().indexOf("firefox") > -1) {
20             this.on("DOMMouseScroll", function (e) {
21                 var origEvent = e.originalEvent;
22                 element.scrollTop += origEvent.detail > 0 ? 60 : -60;
23                 origEvent.preventDefault();
24             });
25         } else {
26             element.onmousewheel = function (e) {
27                 e = e || window.event;
28                 element.scrollTop += e.wheelDelta > 0 ? -60 : 60;
29                 e.preventDefault();
30                 e.returnValue = false;
31             };
32         }
33         return this;
34     };
35     $.fn.preventScroll = function () {
36         var element = this.get(0);
37         if (navigator.userAgent.toLowerCase().indexOf("firefox") > -1) {
38             this.on("DOMMouseScroll", mouseScroll);
39         } else {
40             $(element).on("mousewheel", mouseWheel);
41         }
42         return this;
43     };
44     $.fn.liveScroll = function() {
45         var element = this.get(0);
46         if (navigator.userAgent.toLowerCase().indexOf("firefox") > -1) {
47             this.off("DOMMouseScroll", mouseScroll);
48         } else {
49             $(element).off("mousewheel", mouseWheel);
50         }
51         return this;
52     };
53 }($));
时间: 2024-10-11 17:50:10

scrollHelper的相关文章

XtraScrollableControl 滚动条控件随鼠标滚动

using System; using System.Windows.Forms; using DevExpress.XtraEditors; namespace WindowsFormsApplication1 { public class ScrollHelper { readonly XtraScrollableControl _scrollableControl; public ScrollHelper(XtraScrollableControl scrollableControl) {

xtraScrollableControl 滚动条随鼠标滚动

代码如下 // using System; using System.Windows.Forms; using DevExpress.XtraEditors; namespace WindowsFormsApplication1 { public class ScrollHelper { readonly XtraScrollableControl _scrollableControl; public ScrollHelper(XtraScrollableControl scrollableCo

滚动条相关1

1.页面文档滚动条 获取和判断 //1.获取浏览器可视区域的高度 $(window).resize(function () { //使用js //var clientHeight = scrollHelper.getClientHeight(); //使用 jquery var clientHeight = $(window).height(); $(".divFixed").text(clientHeight); }); //2.获取浏览器文档的高度 $(window).resize

DialogHelper

1 //require ScrollHelper.js 2 function DialogHelper() { 3 var _this = this; 4 var doc = window.document; 5 _this.maskDiv = null; 6 _this.contentDiv = null; 7 var options = { 8 opacity: 0.4 9 }; 10 11 this.popup = function (contentdiv, optionArg) { 12