onmousewheel跟onscroll的区别
2024-09-26 16:29:40
研习DOM中的事件方法,发现一些细微差别,百度一下没有类似的解答,随手记下来。
onmousewheel事件
以下摘自http://help.dottoro.com/ljmracjb.php
Browser support:
IE,火狐,opera,sarafi,chrome
Occurs when the mouse wheel rolls.In Firefox, use the DOMMouseScroll event and the detail event property instead.Note: the onmousewheel and DOMMouseScroll events are also fired on elements that have no scrollbar or when the contents are not scrolled. If you would like to receive a notification when the contents of an element are scrolled, use the onscroll event.
翻译:该事件发生在鼠标滚轮滚动时,火狐中,使用DOMMouseScroll跟其细节事件(参看http://help.dottoro.com/ljrxdxdw.php及http://www.feiesoft.com/html/events/onmousewheel.html)代替。注意:onmousewheel和DOMMouseScroll事件,在没有滚动条或者内容没有被滚动的时候也会发生,意思是只要鼠标动不管页面动不动。如果你是想一个元素内容滚动后接受一个通知的话,使用onscroll事件。
onscroll事件
Browser support:
IE,火狐,opera,sarafi,chromeOccurs when the contents of an element have been scrolled.This event is only fired on elements that have a scrollbar. Use the overflow style property to create scrollbars for an element.
翻译:事件发生在元素内容滚动的时候,也包括键盘上下键,载入也可触发。事件仅仅在有滚动条时发生,使用overflow属性为元素创建一个滚动条。
ok,就这样。
最新文章
- T-SQL删除重复数据
- 如何使用mybatis《三》
- table 操作
- Git 在小团队中的管理流程(转)
- 【转】JDBC学习笔记(4)——PreparedStatement的使用
- 在 iOS 10.0 之后, App 要调用手机相机与相簿应注意的事项
- ES ik分词器使用技巧
- HTTP/1.1 请求方法
- js实现简易版validate
- SharePoint Framework解决方案管理参考(一)
- Netty实战五之ByteBuf
- Python 中if __name__ == '__main__': 的作用和原理
- [iOS]改变UIAlertController的标题、内容的字体和颜色
- 搭建基于IDEA+Selenium+Java+TestNG+Maven+Jenkins+SVN的Web端UI自动化测试环境
- selenium +chromdriver模块
- 7.ViewPagerIndicator
- vi常用命令总结
- Vue插件写、用详解(附demo)
- HDU 4366 Successor(dfs序 + 分块)题解
- MySQL on Linux 部署手册