Vlastnost vlastnosti scrollBehavior stylu
Příklad
Přidejte na stránku efekt hladkého posouvání:
document.documentElement.style.scrollBehavior = "smooth";
Definice a použití
Vlastnost scrollBehavior určuje, zda se má plynule animovat pozice posouvání namísto přímého skoku, když uživatel klikne na odkaz v rolovatelném poli.
Podpora prohlížeče
Property | |||||
---|---|---|---|---|---|
scrollBehavior | 61.0 | 79.0 | 36.0 | 14.0 | 48.0 |
Syntax
object.style.scrollBehavior = "auto|smooth|initial|inherit"
Hodnoty vlastností
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 |
Související stránky
CSS reference: vlastnost scroll-behavior
❮ Objekt stylu