需要写一个滚动条滑动加载图片的程序,研究了一下onscroll在不同浏览器里的执行次数,分别如下:

var i=0;
E.addHandler(window, 'scroll', function(){
console.log(i++);
})

firefox

chrome

ie8

总结

滚轮动一下ie执行的次数太多了,需要写个方法,某段时间只执行一次。

var i=0,
scrollTimer;
E.addHandler(window, 'scroll', function(){
if(scrollTimer) clearTimeout(scrollTimer);
scrollTimer = setTimeout(function(){
console.log(i++);
}, 200);
})

鼠标滚动事件onscroll在firefox/chrome/Ie中执行次数的问题处理的更多相关文章

  1. 给浏览器绑定鼠标滚动事件(兼容FireFox)

    var bs = new Browser(); if(bs.userBrowser() == 'firefox'){ document.body.addEventListener("DOMM ...

  2. 在FireFox浏览器上,用stopImmediatePropagation阻止冒泡鼠标滚动事件

    楔子 是不是在火狐用stopPropagation不太满意 很久没有笑过又不知为何 既然不快乐又不喜欢这里 不如一路向西用stopImmediatePropagation(其实我对浏览器的兼容性看不顺 ...

  3. JS鼠标滚动事件

    -----------------------------//鼠标滚动事件以下是JS临听鼠标滚动事件 并且还考虑到了各浏览器的兼容----------------------------------- ...

  4. js进阶 12-6 监听鼠标滚动事件和窗口改变事件怎么写

    js进阶 12-6 监听鼠标滚动事件和窗口改变事件怎么写 一.总结 一句话总结:滚动事件scroll(),浏览器窗口调整监听resize(),思考好监听对象. 1.滚动事件scroll()的监听对象是 ...

  5. vue组件添加鼠标滚动事件

    在一个组件标签上加鼠标滚动事件,应该写成    @mousewheel.native

  6. 鼠标滚动事件 - onmousewheel

    1.Jquery-MouseWheel jquery默认是不支持支持鼠标滚轮事件(mousewheel) jquery MouseWheel下载:https://github.com/jquery/j ...

  7. JavaScript一个鼠标滚动事件的实例

    <script type="text/javascript" src="./whenReady.js"></script> <!- ...

  8. js监控鼠标滚动事件

    //滚动动画 windowAddMouseWheel(); function windowAddMouseWheel() { var scrollFunc = function (e) { e = e ...

  9. 解决ScrollViewer嵌套的DataGrid、ListBox等控件的鼠标滚动事件无效

    C# 中,两个ScrollViewer嵌套在一起或者ScrollViewer里面嵌套一个DataGrid.ListBox.Listview(控件本身有scrollviewer)的时候,我们本想要的效果 ...

随机推荐

  1. yaml文件

    apiVersion: apps/v1beta1 kind: Deployment metadata: annotations: deployment.kubernetes.io/revision: ...

  2. identifier of an instance of com.xxx.model.system.xxxObject was altered from 1765 to 1766

    Caused by: org.hibernate.HibernateException: identifier of an instance of com.xxx.model.system.xxxOb ...

  3. Win32 Error Code COM Error Code NTSTATUS的区别、转换

    这三种码其实都是Windows系统错误码,只是对应不同API和使用场景.它们既有区别,又相互有联系. 一.区别和联系 都是32位值 Win32 Error Code和NTSTATUS位域组成相同,但W ...

  4. 细说 call、apply 以及 bind 的区别和用法

    call 和 apply 的共同点 它们的共同点是,都能够改变函数执行时的上下文,将一个对象的方法交给另一个对象来执行,并且是立即执行的. 为何要改变执行上下文?举一个生活中的小例子:平时没时间做饭的 ...

  5. 题解 UVA11105 【H-半素数 Semi-prime H-numbers】

    做这道题之前首先要掌握的是线性筛的模板 附上题目链接 https://www.luogu.org/problem/P3383 首先这道题目的范围有些特殊必须是% 4 == 1的数才行 所以可以这样 直 ...

  6. 洛谷P1019 单词接龙题解(超详细注释)

    https://www.luogu.org/problem/P1019 #include<cstdio> #include<cstring> #include<iostr ...

  7. Mujin Programming Challenge 2017题解

    传送门 \(A\) 似乎并不难啊然而还是没想出来-- 首先我们发现对于一个数\(k\),它能第一个走到当且仅当对于每一个\(i<k\)满足\(x_i\geq 2i-1\),这样我们就可以把所有的 ...

  8. 数据结构实验之排序二:交换排序 (SDUT 3399)

    #include <iostream> #include <bits/stdc++.h> using namespace std; typedef long long ll; ...

  9. 备用shell管理方案之butterfly+nginx+https

    安装butterfly+nginx https 1. 安装butterfly yum install python36 python36-pip python36-devel -y pip insta ...

  10. js中的那些遍历

    说到遍历,首先想到的是数组的遍历,方法不要太多,比如 for, forEach,map,filter,every,some等 下面来看下,用法 首先 定义一个数组: 1. for循环,需要知道数组的长 ...