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,就这样。
     
  • 相关阅读:
    如何在iTerm2中配置oh my zsh?
    sublime中格式化jsx文件
    ES6 new syntax of Literal
    ES6 new syntax of Rest and Spread Operators
    How to preview html file in our browser at sublime text?
    ES6 new syntax of Default Function Parameters
    ES6 new syntax of Arrow Function
    七牛云2018春招笔试题
    Spring-使用注解开发(十二)
    Spring-声明式事物(十一)
  • 原文地址:https://www.cnblogs.com/jiangtian/p/onmousewheel-onscroll.html
Copyright © 2011-2022 走看看