CSSOM
The CSSViewTransitionRule interface represents a CSS @view-transition at-rule.
Instance properties
Inherits properties from its ancestor, CSSRule.
- CSSViewTransitionRule.navigation
- : Returns the
@view-transitionat-rule'snavigationdescriptor value.
- : Returns the
- CSSViewTransitionRule.types
- : Returns an array containing the
@view-transitionat-rule'stypesdescriptor values.
- : Returns an array containing the
Instance methods
Inherits methods from its ancestor, CSSRule.
Examples
Basic usage
A stylesheet includes a @view-transition at-rule, with navigation and types descriptors set:
@view-transition {
navigation: auto;
types: slide rotate;
}
In script, we grab a reference to the @view-transition at-rule using document.styleSheets[0].cssRules, then log the corresponding CSSViewTransitionRule object and its navigation and types properties to the console. The types property returns an array containing the values set for the types descriptor.
let myRule = document.styleSheets[0].cssRules;
console.log(myRule[0]); // a CSSViewTransitionRule representing the @view-transition at-rule
console.log(myRule[0].navigation); // "auto"
console.log(myRule[0].types); // ["slide", "rotate"]
Specifications
Browser compatibility
See also
- @view-transition
- View Transition API
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
