The htmx:after:viewTransition event fires after a View Transition animation completes.

When It Fires

After the View Transition API finishes animating the swap operation.

Fires on the element that triggered the swap, or on document when there is none.

Event Detail

  • task - Transition callback information
  • ctx - The request context driving the swap

Example

htmx.on('htmx:after:viewTransition', (evt) => { console.log('View transition complete'); // Perform actions after transition animation });

The swap and transition are both complete at this point.