`
yiminghe
  • 浏览: 1433191 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

weird mousemove in chrome

阅读更多

mousemove


根据 w3c 的 mousemove 规范:


The mouseover event occurs when the pointing device is moved onto an element.


即只有当鼠标(pointing device)在某个元素上移动时才会触发。


click


以及 click 规范,点击事件和 mouse(down,up)事件有很大的关联性:


The click event occurs when the pointing device button is clicked over an element. A click is defined as a mousedown and mouseup over the same screen location. The sequence of these events is:

    mousedown
    mouseup
    click
  

在触发 click 事件前必定会先触发 mousedown 与 mouseup。


weird mousemove in chrome


但是目前根据我的测试,chrome 8 在 click 的情况下又自作主张地在 mouseup 上面又加了个 mousemove 事件(确实chrome下即使单纯点击,光标也会有点闪动,难道这也算作移动了??),在拖放 实现中就要小心点了。



mousemove demo



感想:


做前端工程师真的很累,想完美点就会累死人,还不说目前形形色色的外壳浏览器们。只能期求浏览器发布商在开发中多多遵守规范吧。


 

PS : 确实在某些机器上触发不了 mousemove,真的奇怪了,分析下原因

 

1.桌子不稳,其他浏览器都有防抖功能。

2.鼠标有问题,换了个鼠标确实chrome下问题减轻了,按下时光标不会发生变化了,但mousemove仍然会不时产生。



  • 大小: 4.5 KB
分享到:
评论
3 楼 wan_jm 2014-07-08  
chrome 35. 仍然间断性遇到这个现象!
window 7; IE 11,和firefox没有这么问题;
2 楼 yiminghe 2010-10-30  
ayanamist 写道
我在Chrome 8.0.552.18中没有碰到这个问题,没有触发mousemove事件


所以很奇怪了,我这里确实触发了,而有些机器就没有
1 楼 ayanamist 2010-10-29  
我在Chrome 8.0.552.18中没有碰到这个问题,没有触发mousemove事件

相关推荐

Global site tag (gtag.js) - Google Analytics