zoukankan      html  css  js  c++  java
  • onmousewheel跟onscroll的区别

    研习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,chrome
    Occurs 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,就这样。
     
  • 相关阅读:
    vue项目接入百度地图
    angularJS 十六进制与字符串相互转换
    angular项目实现mqtt的订阅与发布 ngx-mqtt
    消息中间件MQTT
    Zigbee 与 WiFi 的区别
    angular6 路由拼接查询参数如 ?id=1 并获取url参数
    SpringBoot拦截器
    SpringBoot定时任务
    SpringBoot 各层之间的关系
    百度离线地图 —— 瓦片地图下载
  • 原文地址:https://www.cnblogs.com/jiangtian/p/onmousewheel-onscroll.html
Copyright © 2011-2022 走看看