-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cross-document view transitions demo (#265)
* Add cross-document view transitions demo * Fixes for pepelsbey review comments * small best practice updates that came up in the content tech review
- Loading branch information
1 parent
98c8bb8
commit 4c1e311
Showing
17 changed files
with
108 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<title>Cross-document view transition example: Page 1</title> | ||
<link rel="stylesheet" href="styles.css"> | ||
</head> | ||
|
||
<body> | ||
<p><a href="page2.html">Go to page 2</a></p> | ||
<img src="images/image1.jpg" alt="A suspension bridge spanning a river, with a cityscape on the other side."> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<title>Cross-document view transition example: Page 2</title> | ||
<link rel="stylesheet" href="styles.css"> | ||
</head> | ||
|
||
<body> | ||
<p><a href="index.html">Go back to page 1</a></p> | ||
<img src="images/image2.jpg" alt="A large green tropical leaf in the middle of a jungle."> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* Example layout */ | ||
|
||
html { | ||
font-family: Arial, Helvetica, sans-serif; | ||
height: 100%; | ||
} | ||
|
||
body { | ||
margin: 0; | ||
height: inherit; | ||
} | ||
|
||
img { | ||
width: 100vw; | ||
height: 100vh; | ||
object-fit: cover; | ||
} | ||
|
||
p { | ||
position: absolute; | ||
top: 20px; | ||
left: 20px; | ||
font-size: 2rem; | ||
padding: 20px; | ||
margin: 0; | ||
border-radius: 5px; | ||
background-color: rgba(255 255 255 / 0.8); | ||
} | ||
|
||
/* Turn cross-document view-transitions on */ | ||
/* Note that this at-rule is all that is needed to create the default cross-fade animation */ | ||
|
||
@view-transition { | ||
navigation: auto; | ||
} | ||
|
||
/* Customize the default animation behavior */ | ||
|
||
::view-transition-group(root) { | ||
animation-duration: 0.5s; | ||
} | ||
|
||
/* Create a custom animation */ | ||
|
||
@keyframes move-out { | ||
from { | ||
transform: translateY(0%); | ||
} | ||
|
||
to { | ||
transform: translateY(-100%); | ||
} | ||
} | ||
|
||
@keyframes move-in { | ||
from { | ||
transform: translateY(100%); | ||
} | ||
|
||
to { | ||
transform: translateY(0%); | ||
} | ||
} | ||
|
||
/* Apply the custom animation to the old and new page states */ | ||
|
||
::view-transition-old(root) { | ||
animation: 0.4s ease-in both move-out; | ||
|
||
} | ||
|
||
::view-transition-new(root) { | ||
animation: 0.4s ease-in both move-in; | ||
} |
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters