ViewTransition: skipTransition() method
Baseline
2025
Newly available
Since October 2025, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
Phương thức skipTransition() của giao diện ViewTransition bỏ qua phần hoạt ảnh của view transition, nhưng không bỏ qua việc chạy cập nhật view liên quan.
Cú pháp
js
skipTransition()
Tham số
Không có.
Giá trị trả về
undefined.
Ví dụ
>Bỏ qua một view transition SPA
js
// start new view transition
const transition = document.startViewTransition(() => displayNewImage());
// skip the animation and just update the DOM
transition.skipTransition();
Bỏ qua một view transition MPA
js
// Fired on the current (outgoing) page
document.addEventListener("pageswap", (event) => {
event.viewTransition?.skipTransition();
});
// Fired on the destination (inbound) page
document.addEventListener("pagereveal", (event) => {
event.viewTransition?.skipTransition();
});
Thông số kỹ thuật
| Specification |
|---|
| CSS View Transitions Module Level 1> # dom-viewtransition-skiptransition> |