// start new view transition
const transition = document.startViewTransition(() => displayNewImage());
// skip the animation and just update the DOM
transition.skipTransition();ViewTransition: skipTransition() method / notebook
ViewTransition: skipTransition() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
// 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();
});