At the time of writing the View Transition API only works in Chrome Canary.
1. Enable the following feature flags in Chrome Canary
2. First line of code
Copy and paste this meta tag into your <head>
.
3. Second line of code
Decide on the element you want to transition from on page1.html
. In this example, I’m using the page container <div>
.
4. Third line of code
Decide on the element you want to transition to on page2.html
. In this example, I’m using the page container <div>
for page2.html
.
Done! Now when you navigate from page1.html
to page2.html
(and vice versa), the browser will animate the transition between the two pages.