Posts

Showing posts from May, 2025

Tips from using 'view transitions' in JavaScript

Image
 I have been using Chrome's 'view transitions'. I set the 'view-transition-name' property in CSS classes and add (or remove) these CSS classes from the 'document.documentElement' root HTML element. I can do this when the 'view transition' ends using a promise:     transition =         document.startViewTransition(play);     transition.finished.then(finishViewTransition); I use a 'do nothing' 'view transition' to animate showing a dialog box without animating the whole page:     ::view-transition-old(doNothing),     ::view-transition-new(doNothing) {         animation: none;     }     .vtDoNothing {         view-transition-name: doNothing;     }     #confirmBox {     ...     document.documentElement.className += 'vtDoNothing'; I var...