Execute a JavaScript when a <div> element is being scrolled:
The onscroll attribute fires when an element's scrollbar is being scrolled.
Tip: use the CSS overflow style property to create a scrollbar for an element.
Event Attribute | |||||
---|---|---|---|---|---|
onscroll | Yes | Yes | Yes | Yes | Yes |
The onscroll attribute is new in HTML5.
Value | Description |
---|---|
script | The script to be run on onscroll |
Supported HTML tags: | <address>, <blockquote>, <body>, <caption>, <center>, <dd>, <dir>, <div>, <dl>, <dt>, <fieldset>, <form>, <h1> to <h6>, <html>, <li>, <menu>, <object>, <ol>, <p>, <pre>, <select>, <tbody>, <textarea>, <tfoot>, <thead>, <ul> |
---|
HTML DOM reference: onscroll event