Styl scrollBehavior Property
Voorbeeld
Voeg 'n gladde blaai-effek by 'n bladsy:
document.documentElement.style.scrollBehavior = "smooth";
Definisie en gebruik
Die scrollBehavior-eienskap spesifiseer of die rolposisie glad geanimeer moet word, in plaas van 'n reguit sprong, wanneer die gebruiker op 'n skakel in 'n rolbare blokkie klik.
Blaaierondersteuning
Property | |||||
---|---|---|---|---|---|
scrollBehavior | 61.0 | 79.0 | 36.0 | 14.0 | 48.0 |
Sintaksis
object.style.scrollBehavior = "auto|smooth|initial|inherit"
Eiendomswaardes
Value | Description |
---|---|
auto | Default. Allows a straight jump "scroll effect" between elements within the scrolling box. |
smooth | Allows a smooth animated "scroll effect" between elements within the scrolling box. |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Verwante bladsye
CSS-verwysing: rolgedrag-eienskap
❮ Stylvoorwerp