A MutationObserver can be used to trigger automatic view transitions by observing DOM changes and reapplying mutations wrapped in `document.startViewTransition`. This avoids the need to manually add the transition code throughout your JavaScript, ensuring smooth transitions for added or removed elements. Examples include adding or removing cards from a list with seamless transitions captured by the snapshotting process.

4m read timeFrom bram.us
Post cover image
Table of contents
# The need for automatic View Transitions# Auto-trigger a View Transition with MutationObserver# Spread the word

Sort: