1. 主题明暗切换 https://juejin.cn/post/7508588026316668979

    themeButton.addEventListener('click', () => {
        document.startViewTransition(() => {
            document.documentElement.classList.toggle('dark');
        }).ready.then(()=>{
            //...
        });
    });
    
  2. 网页间过渡效果
    in html head tag:

    <style>
        @view-transition {
            navigation: auto;
        }
    </style>
    

更多参考:
https://developer.chrome.google.cn/docs/web-platform/view-transitions/cross-document?hl=zh-cn
https://developer.mozilla.org/zh-CN/docs/Web/CSS/Reference/At-rules/@view-transition

* Total words: 44