CSSViewTransitionRule

Khả dụng hạn chế

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Giao diện CSSViewTransitionRule đại diện cho một at-rule CSS @view-transition at-rule.

CSSRule CSSViewTransitionRule

Thuộc tính phiên bản

Kế thừa các thuộc tính từ tổ tiên CSSRule.

Trả về giá trị descriptor navigation của at-rule @view-transition.

types Read only

Trả về một mảng chứa các giá trị descriptor types của at-rule @view-transition.

Phương thức phiên bản

Kế thừa các phương thức từ tổ tiên CSSRule.

Ví dụ

Sử dụng cơ bản

Một stylesheet bao gồm một at-rule @view-transition at-rule, với các descriptor navigationtypes được đặt:

css
@view-transition {
  navigation: auto;
  types: slide, rotate;
}

Trong script, chúng ta lấy một tham chiếu đến at-rule @view-transition bằng document.styleSheets[0].cssRules, sau đó ghi lại đối tượng CSSViewTransitionRule tương ứng và các thuộc tính navigationtypes của nó vào console.

js
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"]

Thông số kỹ thuật

Thông số kỹ thuật
CSS View Transitions Module Level 2
# cssviewtransitionrule

Tương thích trình duyệt

Xem thêm