ViewTransition: skipTransition()-Methode

Limited availability

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

Die skipTransition()-Methode der ViewTransition-Schnittstelle überspringt den Animationsanteil der Ansichtsübertragung, führt jedoch das zugehörige Ansichtsupdate weiterhin aus.

Syntax

js
skipTransition()

Parameter

Keine.

Rückgabewert

undefined.

Beispiele

Überspringen einer SPA-Ansichtsübertragung

js
// start new view transition
const transition = document.startViewTransition(() => displayNewImage());

// skip the animation and just update the DOM
transition.skipTransition();

Überspringen einer MPA-Ansichtsübertragung

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();
});

Spezifikationen

Specification
CSS View Transitions Module Level 1
# dom-viewtransition-skiptransition

Browser-Kompatibilität

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
skipTransition

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support

Siehe auch