Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add view transitions using MPA pattern to Twenty Seventeen theme. #8028

Draft
wants to merge 4 commits into
base: trunk
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions src/wp-content/themes/twentyseventeen/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,44 @@ html {
-webkit-text-size-adjust: 100%;
}

@view-transition {
navigation: auto;
}

/* Mark the `<main>` element as the element that should transition */
#content {
view-transition-name: my-main-content;
}

/* Apply animations to the snapshots */
/* Note, `main-content` is the view transition name specified in the previous CSS block */
::view-transition-old(my-main-content) {
animation: 500ms ease-out both slide-out;
}

::view-transition-new(my-main-content) {
animation: 500ms ease-out both slide-in;
}

/* Define the animations */
@keyframes slide-out {
from {
transform: translateX(0);
}
to {
transform: translateX(-100%);
}
}

@keyframes slide-in {
from {
transform: translateX(100%);
}
to {
transform: translateX(0);
}
}

body {
margin: 0;
}
Expand Down
Loading