onscroll event
Examples
JavaScript is executed when the <div> element rolling
<Div onscroll = "myFunction ()">
try it"
Definition and Usage
onscroll event is triggered when scrolling element scroll bar.
Tip: Use the CSS overflow style property to create a scroll bar elements.
Browser Support
Event | |||||
---|---|---|---|---|---|
onscroll | Yes | Yes | Yes | Yes | Yes |
grammar
In HTML:
<Elementonscroll = "myScript"> try
In JavaScript:
object .onscroll = function () {myScript }; try
JavaScript, use the addEventListener () method:
object .addEventListener ( "scroll", myScript ); try
Note: Internet Explorer 8 and earlier versions of IE do not support addEventListener () method.
Technical Details
technical details
Whether to support the bubble: | Yes |
---|---|
It can be canceled: | No |
Event Type: | Event |
Supported HTML tags: | <Address>, <blockquote>, <body>, <caption>, <center>, <dd>, <dir>, <div>, <dl>, <dt>, <fieldset>, <form>, <h1 > - <h6>, <html>, <li>, <menu>, <object>, <ol>, <p>, <pre>, <select>, <tbody>, <textarea>, <tfoot>, <thead>, <ul> |