onmousewheel跟onscroll的区别

onmousewheel事件

以下摘自http://help.dottoro.com/ljmracjb.php
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.

翻译: 该事件发生在鼠标滚轮滚动时,火狐中,使用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属性为元素创建一个滚动条。

转自 onmousewheel跟onscroll的区别

你可能感兴趣的:(onmousewheel,onscroll)