HTML -Onscroll- Ereignisattribut
Beispiel
Führen Sie ein JavaScript aus, wenn ein <div>-Element gescrollt wird:
<div onscroll="myFunction()">
Definition und Verwendung
Das onscroll-Attribut wird ausgelöst, wenn die Bildlaufleiste eines Elements gescrollt wird.
Tipp: Verwenden Sie die CSS -Eigenschaft overflow style, um eine Bildlaufleiste für ein Element zu erstellen.
Browser-Unterstützung
Event Attribute | |||||
---|---|---|---|---|---|
onscroll | Yes | Yes | Yes | Yes | Yes |
Syntax
<element onscroll="script">
Attributwerte
Value | Description |
---|---|
script | The script to be run on onscroll |
Technische Details
Unterstützte HTML-Tags: | <address>, <blockquote>, <body>, <caption>, <center>, <dd>, <dir>, <div>, <dl>, <dt>, <fieldset>, <form>, <h1 > bis <h6>, <html>, <li>, <menu>, <object>, <ol>, <p>, <pre>, <select>, <tbody>, <textarea>, <tfoot>, <thead>, <ul> |
---|
Verwandte Seiten
HTML-DOM-Referenz: onscroll-Ereignis
❮ HTML-Ereignisattribute