├── .gitignore ├── LICENSE ├── README.md ├── demo ├── index.html ├── mpa │ ├── both │ │ └── 23.html │ ├── enter │ │ ├── 0.html │ │ ├── 1.html │ │ ├── 10.html │ │ ├── 11.html │ │ ├── 12.html │ │ ├── 13.html │ │ ├── 14.html │ │ ├── 15.html │ │ ├── 16.html │ │ ├── 17.html │ │ ├── 18.html │ │ ├── 19.html │ │ ├── 2.html │ │ ├── 20.html │ │ ├── 21.html │ │ ├── 22.html │ │ ├── 23.html │ │ ├── 24.html │ │ ├── 3.html │ │ ├── 4.html │ │ ├── 5.html │ │ ├── 6.html │ │ ├── 7.html │ │ ├── 8.html │ │ └── 9.html │ ├── exit │ │ ├── 0.html │ │ ├── 1.html │ │ ├── 10.html │ │ ├── 11.html │ │ ├── 12.html │ │ ├── 13.html │ │ ├── 14.html │ │ ├── 15.html │ │ ├── 16.html │ │ ├── 17.html │ │ ├── 18.html │ │ ├── 19.html │ │ ├── 2.html │ │ ├── 20.html │ │ ├── 21.html │ │ ├── 22.html │ │ ├── 23.html │ │ ├── 24.html │ │ ├── 3.html │ │ ├── 4.html │ │ ├── 5.html │ │ ├── 6.html │ │ ├── 7.html │ │ ├── 8.html │ │ └── 9.html │ └── index.html ├── shared │ ├── randomize.module.js │ └── styles.css └── spa │ └── index.html ├── netlify.toml ├── package-lock.json ├── package.json └── src ├── ie-page-transitions.css ├── ie-page-transitions.mpa.js ├── ie-page-transitions.shared.js └── ie-page-transitions.spa.js /.gitignore: -------------------------------------------------------------------------------- 1 | /demo/dist 2 | /node_modules 3 | 4 | # Local Netlify folder 5 | .netlify 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ie-page-transitions 2 | 3 | Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API 4 | 5 | [![Source](https://img.shields.io/badge/Source-GitHub-2dba4e)](https://github.com/bramus/ie-page-transitions) 6 | [![npm](https://img.shields.io/npm/v/ie-page-transitions)](https://www.npmjs.com/package/ie-page-transitions) 7 | [![NPM](https://img.shields.io/npm/l/ie-page-transitions)](./LICENSE) 8 | [![Demo](https://img.shields.io/badge/demo-_Website-hotpink)](https://page-transitions.style/) 9 | 10 | ## Internet Explorer’s Page Transitions 11 | 12 | Microsoft Internet Explorer 4.0 and above featured a proprietary feature called [Interpage Transitions](https://learn.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms532847(v=vs.85)?redirectedfrom=MSDN#interpage-transitions). It allowed you to specify [a transition effect](https://learn.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms532853(v=vs.85)#transitions) to apply to the entire window as a Web page was loaded or exited. 13 | 14 | The feature worked best as of Microsoft Internet Explorer 5.5 which had a richer variety of optimized filters. The feature was eventually deprecated with the release of Windows Internet Explorer 9. 15 | 16 | Transitions were specified using a meta tag in the `` of a web page. For example, the following snippet caused the [`Blinds` transition](https://learn.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms532976(v=vs.85)) to play when the user loaded the page and caused a [`Slide` transition](https://learn.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms533087(v=vs.85)) to play when the user exited the page. 17 | 18 | ```html 19 | 20 | 21 | ``` 22 | 23 | Four events could create instances of interpage transitions: `Page-Enter`, `Page-Exit`, `Site-Enter`, and `Site-Exit`. 24 | 25 | ### The `RevealTrans` Filter 26 | 27 | The Page Transitions feature also came with a shorthand [the `DXImageTransform.Microsoft.RevealTrans` Filter](https://learn.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms533085(v=vs.85)), which offered 23 predefined transitions mirrored from the effects found in Microsoft PowerPoint. 28 | 29 | Using one of these predefined effects was as easy as referring to its number – ranging from 0 to 22 – in the `revealTrans`’s filter `Transition` property. Using the value `23` randomly selected one of the 23 available effects. 30 | 31 | For example, using the following snippet caused Transition Effect number `7` – a vertical wipe from right to left – to play when the page was loaded. 32 | 33 | ```html 34 | 35 | ``` 36 | 37 | Under the hood the `revealTrans(Transition=7)` mapped to a `DXImageTransform.Microsoft.Blinds(direction='left', bands=1)` effect. 38 | 39 | ## Requirements 40 | 41 | For Page Transitions to run, a browser with built-in Page Transitions support or a browser with support for the View Transition API + [Selective View Transitions with Active Types](https://drafts.csswg.org/css-view-transitions-2/#selective-vt) is required. 42 | 43 | - SPA 44 | - Chrome 125+ 45 | - Safari 18.2 46 | 47 | - MPA 48 | - IE 5.5 - 8.0 _(built-in)_ 49 | - Chrome 126+ 50 | - Safari 18.2 _(buggy)_ 51 | 52 | In browsers with no support for View Transitions, no effects will be run. The presence of `ie-page-transitions.css` won’t affect these browsers. 53 | 54 | ## Installation 55 | 56 | You can install this package from NPM: 57 | 58 | ``` 59 | npm install ie-page-transitions 60 | ``` 61 | 62 | Or, alternatively, load the files directly from a CDN: 63 | 64 | - unpkg: `https://unpkg.com/ie-page-transitions/` + `path/to/file.ext` 65 | - JSDelivr: `https://cdn.jsdelivr.net/npm/ie-page-transitions/` + `path/to/file.ext` 66 | - SkyPack: `https://cdn.skypack.dev/ie-page-transitions/` + `path/to/file.ext` 67 | - ESM.sh: `https://esm.sh/ie-page-transitions/` + `path/to/file.ext` 68 | 69 | ## Usage 70 | 71 | ### MPA 72 | 73 | 1. Enable Cross-Document View Transitions between two same-origin pages 74 | 75 | ```html 76 | 81 | ``` 82 | 83 | 2. Include `ie-page-transitions.css` and `ie-page-transitions.mpa.js` on your pages. 84 | 85 | ```html 86 | 87 | 88 | ``` 89 | 90 | *Note: The script **must** be loaded as a module and **must** be set to block rendering.* 91 | 92 | 3. Populate your pages with the meta tag(s) to define which effect(s) you want. _(See [Effect Configuration](#effect-configuration))_ 93 | 94 | ```html 95 | 96 | 97 | ``` 98 | 99 | ### SPA 100 | 101 | 1. Include `ie-page-transitions.css` 102 | 103 | ```html 104 | 105 | ``` 106 | 107 | 2. Inject the meta tags to define which effect you want. _(See [Effect Configuration](#effect-configuration))_ 108 | 109 | 3. If you have an entry effect on the first load, add the following render-blocking script to your page: 110 | 111 | ```html 112 | 116 | ``` 117 | 118 | *Note: There is no real harm in adding this code when you don’t have an entry effect.* 119 | 120 | 4. Instead of calling `document.startViewTransition(callback)` call `PageTransitions.startViewTransition(callback)`. 121 | 122 | ```js 123 | import { startViewTransition } from 'https://unpkg.com/ie-page-transitions/src/ie-page-transitions.spa.js'; 124 | 125 | // Randomize page layout (wrapped in a startViewTransition) 126 | $linkToNextPage.addEventListener('click', (e) => { 127 | e.preventDefault(); 128 | startViewTransition(updateTheDOMSomehow); 129 | }); 130 | ``` 131 | 132 | ## Effect Configuration 133 | 134 | Just like IE, the transition can be configured by setting the proper values in the meta tag: 135 | 136 | - Set `http-equiv` to either `Page-Enter` or `Page-Exit` to define whether this is a page entry or page exit animation 137 | - Set the `Duration` to any number (double) to define the duration in seconds for the effect, eg. `2.0` 138 | - The duration values are limited to `0.5`, `1.0`, `1.5`, and `2.0` 139 | - Set the `Transition` to a number (int) to define which transition effect to use. There are 23 effects, from `0` to `22`. Using the value `23` randomly selects one of the 23 available effects. 140 | 141 | For example, to perform a pixel fade (aka. random dissolve) transition for 2 seconds upon entering a page, this markup is needed: 142 | 143 | ```html 144 | 145 | ``` 146 | 147 | ## The Effects 148 | 149 | @TODO: Video 150 | 151 | | Status | Number | Name | Description | DXImageTransform | 152 | |--------|--------|------------------------|------------------------------------------------------------------------|-------------------------------------------------------------------------| 153 | | ✅ | 0 | Box in | Rectangle towards centre | DXImageTransform.Microsoft.Iris(irisstyle='SQUARE', motion='in') | 154 | | ✅ | 1 | Box out | Rectangle from centre outwards | DXImageTransform.Microsoft.Iris(irisstyle='SQUARE', motion='out') | 155 | | ✅ | 2 | Circle in | Circle towards centre | DXImageTransform.Microsoft.Iris(irisstyle='CIRCLE', motion='in') | 156 | | ✅ | 3 | Circle out | Circle from centre outwards | DXImageTransform.Microsoft.Iris(irisstyle='CIRCLE', motion='out') | 157 | | ✅ | 4 | Wipe up | Horizontal wipe from bottom to top | DXImageTransform.Microsoft.Blinds(direction='up', bands=1) | 158 | | ✅ | 5 | Wipe down | Horizontal wipe from top to bottom | DXImageTransform.Microsoft.Blinds(direction='down', bands=1) | 159 | | ✅ | 6 | Wipe right | Vertical wipe from left to right | DXImageTransform.Microsoft.Blinds(direction='right', bands=1) | 160 | | ✅ | 7 | Wipe left | Vertical wipe from right to left | DXImageTransform.Microsoft.Blinds(direction='left', bands=1) | 161 | | ✅ | 8 | Vertical blinds | Vertical Blinds from left to right | DXImageTransform.Microsoft.Blinds(direction='right') | 162 | | ✅ | 9 | Horizontal blinds | Horizontal blinds from top to bottom | DXImageTransform.Microsoft.Blinds(direction='down') | 163 | | ❌ | 10 | Checkerboard across | Box Blinds from left to right | DXImageTransform.Microsoft.CheckerBoard(direction='right') | 164 | | ❌ | 11 | Checkerboard down | Box Blinds from top to bottom | DXImageTransform.Microsoft.CheckerBoard(direction='down') | 165 | | ❌ | 12 | Random dissolve | Pixel Fade | DXImageTransform.Microsoft.RandomDissolve | 166 | | ✅ | 13 | Split vertical in | Vertical Window Opening from middle to sides | DXImageTransform.Microsoft.Barn(orientation='vertical', motion='in') | 167 | | ✅ | 14 | Split vertical out | Vertical Window Closing from sides to middle | DXImageTransform.Microsoft.Barn(orientation='vertical', motion='out') | 168 | | ❌ | 15 | Split horizontal in | Horizontal Window Opening from middle to top/bottom | DXImageTransform.Microsoft.Barn(orientation='horizontal', motion='in') | 169 | | ❌ | 16 | Split horizontal out | Horizontal Window Closing from top/bottom to middle | DXImageTransform.Microsoft.Barn(orientation='horizontal', motion='out') | 170 | | ✅ | 17 | Strips left down | New content is revealed from the upper left corner to the lower right. | DXImageTransform.Microsoft.Strips(motion='leftdown') | 171 | | ✅ | 18 | Strips left up | New content is revealed from the lower left corner to the upper right. | DXImageTransform.Microsoft.Strips(motion='leftup') | 172 | | ✅ | 19 | Strips right down | New content is revealed from the upper right corner to the lower left. | DXImageTransform.Microsoft.Strips(motion='rightdown') | 173 | | ✅ | 20 | Strips right up | New content is revealed from the lower right corner to the upper left. | DXImageTransform.Microsoft.Strips(motion='rightup') | 174 | | ❌ | 21 | Random bars horizontal | Vertical Line Fade | DXImageTransform.Microsoft.RandomBars(orientation='horizontal') | 175 | | ❌ | 22 | Random bars vertical | Horizontal Line Fade | DXImageTransform.Microsoft.RandomBars(orientation='vertical') | 176 | | ✅ | 23 | Random | Random | | 177 | 178 | ## Differences 179 | 180 | In Internet Explorer it was not possible to have one page define an exit transition and the other page an entry transition. When having both an exit and entry effect, the two would conflict, resulting in no transition happening at all. 181 | 182 | This library does not have the limitation. When both an exit and entry effect are set, these will run sequentially. 183 | 184 | To control the `background-color` of the `::view-transition` backdrop in between the exit and entry effects, set the `--page-transitions-backdrop-color` custom property on the `:root` element. If no color is set, the color `transparent` will be used. 185 | 186 | ## References 187 | 188 | - https://www.simplehtmlguide.com/pagetransitions.php 189 | - https://web.archive.org/web/20111111015459/https://standardista.com/html5/http-equiv-the-meta-attribute-explained/ 190 | - https://force4u.cocolog-nifty.com/skywalker/ie/index.html 191 | - https://learn.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms532942(v=vs.85) 192 | - https://learn.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms533085(v=vs.85) 193 | - http://www.influentialcomputers.com/meta-reveal-demo.asp 194 | - Checkerboard: https://codepen.io/t_afif/pen/ZEZyemJ?editors=0110 195 | - http://www.csgnetwork.com/pagetransitiongen.html 196 | 197 | ## Try it out in an actual IE8 198 | 199 | - Start the local dev server 200 | 201 | ``` 202 | npm run start 203 | ``` 204 | 205 | - Expose the dev server to the public over HTTP, for example using [bore](http://bore.pub) 206 | 207 | ``` 208 | brew install bore-cli 209 | bore local 3000 --to bore.pub 210 | ``` 211 | 212 | - Visit the exposed dev server in IE, using something like BrowserLing or https://copy.sh/v86/ 213 | 214 | ## License 215 | 216 | See enclosed [LICENSE](./LICENSE) 217 | 218 | ## Disclaimer 219 | 220 | This is not an officially supported Google product. 221 | 222 | -------------------------------------------------------------------------------- /demo/index.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions 12 | 13 | 14 | 15 | 16 | 17 |
18 |

IE Page Transitions

19 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

20 |
21 | 22 |
23 |

Demo

24 |

Choose your flavor

25 | 29 | 30 |

Get the code

31 |

You can find the source code on GitHub. Please refer to the included README.md for backstory, installation + usage instructions, browser support, etc.

32 |
33 | 36 | 37 | -------------------------------------------------------------------------------- /demo/mpa/both/23.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
39 |

IE Page Transitions (MPA)

40 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

41 |

← To MPA Index | To Random, again →

42 |
43 |
44 |

Hit the back button or click one of the links above.

45 |
46 | 49 | 50 | -------------------------------------------------------------------------------- /demo/mpa/enter/0.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an entry effect. Hit the refresh button to see it in action again. Use the link above to navigate back to the index page.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/enter/1.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an entry effect. Hit the refresh button to see it in action again. Use the link above to navigate back to the index page.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/enter/10.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an entry effect. Hit the refresh button to see it in action again. Use the link above to navigate back to the index page.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/enter/11.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an entry effect. Hit the refresh button to see it in action again. Use the link above to navigate back to the index page.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/enter/12.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an entry effect. Hit the refresh button to see it in action again. Use the link above to navigate back to the index page.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/enter/13.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an entry effect. Hit the refresh button to see it in action again. Use the link above to navigate back to the index page.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/enter/14.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an entry effect. Hit the refresh button to see it in action again. Use the link above to navigate back to the index page.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/enter/15.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an entry effect. Hit the refresh button to see it in action again. Use the link above to navigate back to the index page.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/enter/16.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an entry effect. Hit the refresh button to see it in action again. Use the link above to navigate back to the index page.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/enter/17.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an entry effect. Hit the refresh button to see it in action again. Use the link above to navigate back to the index page.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/enter/18.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an entry effect. Hit the refresh button to see it in action again. Use the link above to navigate back to the index page.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/enter/19.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an entry effect. Hit the refresh button to see it in action again. Use the link above to navigate back to the index page.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/enter/2.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an entry effect. Hit the refresh button to see it in action again. Use the link above to navigate back to the index page.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/enter/20.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an entry effect. Hit the refresh button to see it in action again. Use the link above to navigate back to the index page.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/enter/21.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an entry effect. Hit the refresh button to see it in action again. Use the link above to navigate back to the index page.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/enter/22.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an entry effect. Hit the refresh button to see it in action again. Use the link above to navigate back to the index page.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/enter/23.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an entry effect. Hit the refresh button to see it in action again. Use the link above to navigate back to the index page.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/enter/24.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an entry effect. Hit the refresh button to see it in action again. Use the link above to navigate back to the index page.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/enter/3.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an entry effect. Hit the refresh button to see it in action again. Use the link above to navigate back to the index page.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/enter/4.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an entry effect. Hit the refresh button to see it in action again. Use the link above to navigate back to the index page.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/enter/5.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an entry effect. Hit the refresh button to see it in action again. Use the link above to navigate back to the index page.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/enter/6.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an entry effect. Hit the refresh button to see it in action again. Use the link above to navigate back to the index page.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/enter/7.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an entry effect. Hit the refresh button to see it in action again. Use the link above to navigate back to the index page.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/enter/8.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an entry effect. Hit the refresh button to see it in action again. Use the link above to navigate back to the index page.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/enter/9.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an entry effect. Hit the refresh button to see it in action again. Use the link above to navigate back to the index page.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/exit/0.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an exit effect. Hit the back button or click the link above to see it in action.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/exit/1.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an exit effect. Hit the back button or click the link above to see it in action.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/exit/10.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an exit effect. Hit the back button or click the link above to see it in action.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/exit/11.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an exit effect. Hit the back button or click the link above to see it in action.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/exit/12.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an exit effect. Hit the back button or click the link above to see it in action.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/exit/13.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an exit effect. Hit the back button or click the link above to see it in action.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/exit/14.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an exit effect. Hit the back button or click the link above to see it in action.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/exit/15.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an exit effect. Hit the back button or click the link above to see it in action.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/exit/16.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an exit effect. Hit the back button or click the link above to see it in action.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/exit/17.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an exit effect. Hit the back button or click the link above to see it in action.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/exit/18.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an exit effect. Hit the back button or click the link above to see it in action.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/exit/19.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an exit effect. Hit the back button or click the link above to see it in action.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/exit/2.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an exit effect. Hit the back button or click the link above to see it in action.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/exit/20.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an exit effect. Hit the back button or click the link above to see it in action.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/exit/21.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an exit effect. Hit the back button or click the link above to see it in action.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/exit/22.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an exit effect. Hit the back button or click the link above to see it in action.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/exit/23.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an exit effect. Hit the back button or click the link above to see it in action.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/exit/24.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an exit effect. Hit the back button or click the link above to see it in action.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/exit/3.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an exit effect. Hit the back button or click the link above to see it in action.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/exit/4.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an exit effect. Hit the back button or click the link above to see it in action.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/exit/5.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an exit effect. Hit the back button or click the link above to see it in action.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/exit/6.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an exit effect. Hit the back button or click the link above to see it in action.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/exit/7.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an exit effect. Hit the back button or click the link above to see it in action.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/exit/8.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an exit effect. Hit the back button or click the link above to see it in action.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/exit/9.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |

IE Page Transitions (MPA)

39 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

40 |

← To MPA Index

41 |
42 |
43 |

This page has only an exit effect. Hit the back button or click the link above to see it in action.

44 |
45 | 48 | 49 | -------------------------------------------------------------------------------- /demo/mpa/index.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (MPA) 12 | 13 | 14 | 15 | 16 | 17 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
32 |

IE Page Transitions (MPA)

33 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

34 |

← To Index

35 |
36 |
37 |

Pages with Entry Effects

38 |

The chosen effect is applied on the new page upon entering it.

39 |
    40 |
  1. Box in
  2. 41 |
  3. Box out
  4. 42 |
  5. Circle in
  6. 43 |
  7. Circle out
  8. 44 |
  9. Wipe up
  10. 45 |
  11. Wipe down
  12. 46 |
  13. Wipe right
  14. 47 |
  15. Wipe left
  16. 48 |
  17. Vertical blinds
  18. 49 |
  19. Horizontal blinds
  20. 50 |
  21. Checkerboard across
  22. 51 |
  23. Checkerboard down
  24. 52 |
  25. Random dissolve
  26. 53 |
  27. Split vertical in
  28. 54 |
  29. Split vertical out
  30. 55 |
  31. Split horizontal in
  32. 56 |
  33. Split horizontal out
  34. 57 |
  35. Strips left down
  36. 58 |
  37. Strips left up
  38. 59 |
  39. Strips right down
  40. 60 |
  41. Strips right up
  42. 61 |
  43. Random bars horizontal
  44. 62 |
  45. Random bars vertical
  46. 63 |
  47. Random
  48. 64 |
  49. Invalid
  50. 65 |
66 | 67 |

Pages with Exit Effects

68 |

The chosen effect is applied on the new page upon exiting it (i.e. when going back to this page).

69 |
    70 |
  1. Box in
  2. 71 |
  3. Box out
  4. 72 |
  5. Circle in
  6. 73 |
  7. Circle out
  8. 74 |
  9. Wipe up
  10. 75 |
  11. Wipe down
  12. 76 |
  13. Wipe right
  14. 77 |
  15. Wipe left
  16. 78 |
  17. Vertical blinds
  18. 79 |
  19. Horizontal blinds
  20. 80 |
  21. Checkerboard across
  22. 81 |
  23. Checkerboard down
  24. 82 |
  25. Random dissolve
  26. 83 |
  27. Split vertical in
  28. 84 |
  29. Split vertical out
  30. 85 |
  31. Split horizontal in
  32. 86 |
  33. Split horizontal out
  34. 87 |
  35. Strips left down
  36. 88 |
  37. Strips left up
  38. 89 |
  39. Strips right down
  40. 90 |
  41. Strips right up
  42. 91 |
  43. Random bars horizontal
  44. 92 |
  45. Random bars vertical
  46. 93 |
  47. Random
  48. 94 |
  49. Invalid
  50. 95 |
96 | 97 |

Page with Entry + Exit Effects

98 |

The new page has both an entry and exit effect applied.

99 |
    100 |
  1. Random
  2. 101 |
102 |
103 | 106 | 107 | -------------------------------------------------------------------------------- /demo/shared/randomize.module.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | const randomColor = () => { 7 | return `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, '0')}`; 8 | } 9 | 10 | // @ref: https://stackoverflow.com/a/35970186/2076595 11 | const invertColor = (hex) => { 12 | if (hex.indexOf('#') === 0) { 13 | hex = hex.slice(1); 14 | } 15 | // convert 3-digit hex to 6-digits. 16 | if (hex.length === 3) { 17 | hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]; 18 | } 19 | if (hex.length !== 6) { 20 | throw new Error('Invalid HEX color.'); 21 | } 22 | var r = parseInt(hex.slice(0, 2), 16), 23 | g = parseInt(hex.slice(2, 4), 16), 24 | b = parseInt(hex.slice(4, 6), 16); 25 | 26 | // invert color components 27 | r = (255 - r).toString(16); 28 | g = (255 - g).toString(16); 29 | b = (255 - b).toString(16); 30 | // pad each with zeros and return 31 | return "#" + r.padStart(2, '0') + g.padStart(2, '0') + b.padStart(2, '0'); 32 | } 33 | 34 | // Randomize page looks 35 | const randomize = () => { 36 | const oldColor = getComputedStyle(document.body).getPropertyValue('background-color'); 37 | document.documentElement.style.setProperty('--page-transitions-backdrop-color', oldColor); 38 | 39 | const newColor = randomColor(); 40 | document.body.style.setProperty('background-color', newColor); 41 | } 42 | 43 | export { randomize } -------------------------------------------------------------------------------- /demo/shared/styles.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | @layer reset { 7 | * { 8 | box-sizing: border-box; 9 | } 10 | html, 11 | body { 12 | background: aliceblue; 13 | } 14 | html { 15 | height: 100%; 16 | } 17 | body { 18 | min-height: 100%; 19 | } 20 | html, body, ul[class] { 21 | margin: 0; 22 | padding: 0; 23 | } 24 | 25 | input, textarea, select, button { 26 | font-family: inherit; 27 | font-size: inherit; 28 | } 29 | } 30 | @layer layout { 31 | html { 32 | line-height: 1.5; 33 | font-size: 1.25em; 34 | font-family:system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; 35 | } 36 | html, body { 37 | background: aliceblue; 38 | } 39 | body { 40 | background-image: linear-gradient(to right, rgb(0 0 0 / 0.05) 1px, transparent 1px), linear-gradient(to bottom, rgb(0 0 0 / 0.05) 1px, transparent 1px); 41 | background-size: 50px 50px; 42 | padding: 3rem 2rem; 43 | color: #333; 44 | } 45 | 46 | header, main, footer { 47 | max-width: 80ch; 48 | width: 90%; 49 | margin: 0 auto; 50 | background: rgb(255 255 255 / 0.5); 51 | border: 1px solid rgb(0 0 0 / 0.2); 52 | border-radius: 0.35rem; 53 | padding: 1rem; 54 | margin: 1rem auto; 55 | 56 | > *:first-child { 57 | margin-top: 0; 58 | } 59 | > *:last-child { 60 | margin-bottom: 0; 61 | } 62 | } 63 | 64 | header { 65 | margin-top: 3rem; 66 | } 67 | 68 | h1, h2 { 69 | font-weight: 700; 70 | text-decoration: underline; 71 | text-decoration-color: hotpink; 72 | text-decoration-thickness: 0.2rem; 73 | text-decoration-style: wavy; 74 | text-decoration-skip-ink: none; 75 | } 76 | 77 | h2 { 78 | text-decoration-color: hsl(156deg 100% 50% / 50%); 79 | } 80 | 81 | a, 82 | a:visited { 83 | color: blue; 84 | } 85 | 86 | footer { 87 | p { 88 | font-size: 0.8em; 89 | text-align: center; 90 | font-style: italic; 91 | } 92 | } 93 | 94 | hr { 95 | height: 0; 96 | border: none; 97 | border-top: 1px solid rgb(0 0 0 / 0.2); 98 | margin: 2rem auto; 99 | } 100 | 101 | form { 102 | border: 1px solid #ccc; 103 | padding: 1rem; 104 | background: rgb(255 255 255 / 0.5); 105 | border: 1px solid rgb(0 0 0 / 0.2); 106 | border-radius: 0.35rem; 107 | } 108 | 109 | .row { 110 | + .row { 111 | margin-top: 1rem; 112 | } 113 | 114 | &:has(button) { 115 | text-align: right; 116 | } 117 | } 118 | 119 | label { 120 | display: block; 121 | font-variant: small-caps; 122 | } 123 | 124 | select { 125 | width: 100%; 126 | } 127 | 128 | button { 129 | padding: 0.2rem 0.4rem; 130 | background: rgb(255 255 255 / 0.5); 131 | border: 1px solid rgb(0 0 0 / 0.2); 132 | border-radius: 0.35rem; 133 | cursor: pointer; 134 | font-weight: 700; 135 | 136 | &:hover, &:focus { 137 | background: white; 138 | color: black; 139 | } 140 | } 141 | } -------------------------------------------------------------------------------- /demo/spa/index.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | IE Page Transitions (SPA) 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 24 | 31 | 32 | 33 | 58 | 59 | 60 | 61 | 62 | 63 | 64 |
65 |

IE Page Transitions (SPA)

66 |

Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API

67 |

← To Index

68 |
69 |
70 |

Choose your effects

71 | 72 |

Use this form to choose the effects to run. When hitting Go, the page will navigate to itself. When choosing “none”, the default View Transition effect (a fade) will be used.

73 | 74 |
75 |
76 | 77 | 104 |
105 |
106 | 107 | 134 |
135 |
136 | 137 |
138 |
139 |
140 | 143 | 144 | -------------------------------------------------------------------------------- /netlify.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | command = "npm run copy-demo-assets" 3 | functions = "netlify/functions" 4 | publish = "demo" 5 | 6 | [[redirects]] 7 | from = "https://ie-page-transitions.netlify.app/*" 8 | to = "https://page-transitions.style/:splat" 9 | status = 301 10 | force = true 11 | 12 | [[headers]] 13 | for = "/*" 14 | [headers.values] 15 | X-XSS-Protection = "1; mode=block" 16 | Referrer-Policy = "no-referrer" 17 | X-Content-Type-Options = "nosniff" 18 | Strict-Transport-Security = "max-age=63072000; includeSubDomains; preload" 19 | Access-Control-Allow-Origin = "*" -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ie-page-transitions", 3 | "version": "0.0.1", 4 | "description": "Bringing back Internet Explorer’s Page Transitions thanks to the View Transition API", 5 | "exports": { 6 | "./": { 7 | "import": "./src/" 8 | } 9 | }, 10 | "files": [ 11 | "src", 12 | "LICENSE", 13 | "README.md" 14 | ], 15 | "scripts": { 16 | "build": "echo \"There is no build step :)\"", 17 | "test": "echo \"Error: no test specified\" && exit 1", 18 | "start": "serve demo", 19 | "prestart": "npm run copy-demo-assets", 20 | "copy-demo-assets": "rm -rf demo/dist && mkdir demo/dist && cp -R -L src/* demo/dist", 21 | "prevent-dirty-tree": "exit $(git status --porcelain | wc -l)", 22 | "preversion": "npm run prevent-dirty-tree", 23 | "release": "npm version $(semver $npm_package_version -i)", 24 | "bump-version-patch-alpha": "npm version $(semver $npm_package_version -i prepatch --preid alpha)", 25 | "bump-version-minor-alpha": "npm version $(semver $npm_package_version -i preminor --preid alpha)", 26 | "bump-version-major-alpha": "npm version $(semver $npm_package_version -i premajor --preid alpha)", 27 | "bump-alpha": "npm version $(semver $npm_package_version -i prerelease)", 28 | "bump-version-patch-beta": "npm version $(semver $npm_package_version -i prepatch --preid beta)", 29 | "bump-version-minor-beta": "npm version $(semver $npm_package_version -i preminor --preid beta)", 30 | "bump-version-major-beta": "npm version $(semver $npm_package_version -i premajor --preid beta)", 31 | "bump-beta": "npm version $(semver $npm_package_version -i prerelease)", 32 | "bump-version-patch": "npm version $(semver $npm_package_version -i patch)", 33 | "bump-version-minor": "npm version $(semver $npm_package_version -i minor)", 34 | "bump-version-major": "npm version $(semver $npm_package_version -i major)", 35 | "bump-version": "npm version $(semver $npm_package_version -i)" 36 | }, 37 | "author": "Bramus ", 38 | "license": "Apache-2.0", 39 | "devDependencies": { 40 | "semver": "^7.6.3", 41 | "serve": "^14.2.1" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/ie-page-transitions.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | /* Inherit some things … */ 7 | ::view-transition-image-pair(root), 8 | ::view-transition-new(root), 9 | ::view-transition-old(root) { 10 | animation-delay: inherit; 11 | animation-timing-function: inherit; 12 | } 13 | 14 | /* Set some generic VT defaults */ 15 | :root:active-view-transition-type(page-transition) { 16 | /* Use linear timing for all */ 17 | &::view-transition-group(root) { 18 | animation-timing-function: linear; 19 | } 20 | 21 | /* Make sure they both appear on top */ 22 | &::view-transition-old(root) { 23 | z-index: 1; 24 | } 25 | &::view-transition-new(root) { 26 | z-index: 2; 27 | } 28 | } 29 | 30 | /* Set default animation to a fade without blending */ 31 | @keyframes fade-in { 32 | from { opacity: 0; } 33 | } 34 | :root:active-view-transition-type(page-transition)::view-transition-new(root) { 35 | animation-name: fade-in; 36 | } 37 | @keyframes fade-out { 38 | to { opacity: 0; } 39 | } 40 | :root:active-view-transition-type(page-transition)::view-transition-old(root) { 41 | animation-name: fade-out; 42 | } 43 | 44 | /* Hide body when there is a manual transition being triggered */ 45 | /* The call to startViewTransition should remove [data-ie-page-transitions] to show the contents again (using a VT)*/ 46 | :root[data-ie-page-transitions] body { 47 | visibility: hidden; 48 | } 49 | :root body { 50 | visibility: visible; 51 | } 52 | 53 | /* Determine Duration */ 54 | :root:active-view-transition-type(page-exit-duration-0_5) { 55 | --ie-page-transitions-exit-duration: 0.5s; 56 | } 57 | :root:active-view-transition-type(page-exit-duration-1_0) { 58 | --ie-page-transitions-exit-duration: 1.0s; 59 | } 60 | :root:active-view-transition-type(page-exit-duration-1_5) { 61 | --ie-page-transitions-exit-duration: 1.5s; 62 | } 63 | :root:active-view-transition-type(page-exit-duration-2_0) { 64 | --ie-page-transitions-exit-duration: 2.0s; 65 | } 66 | :root:active-view-transition-type(page-exit)::view-transition-group(root) { 67 | animation-duration: var(--ie-page-transitions-exit-duration, 1s); 68 | } 69 | 70 | :root:active-view-transition-type(page-enter-duration-0_5) { 71 | --ie-page-transitions-enter-duration: 0.5s; 72 | } 73 | :root:active-view-transition-type(page-enter-duration-1_0) { 74 | --ie-page-transitions-enter-duration: 1.0s; 75 | } 76 | :root:active-view-transition-type(page-enter-duration-1_5) { 77 | --ie-page-transitions-enter-duration: 1.5s; 78 | } 79 | :root:active-view-transition-type(page-enter-duration-2_0) { 80 | --ie-page-transitions-enter-duration: 2.0s; 81 | } 82 | :root:active-view-transition-type(page-enter)::view-transition-group(root) { 83 | animation-duration: var(--ie-page-transitions-enter-duration, 1s); 84 | } 85 | 86 | /* Only page-exit: only animate the old */ 87 | :root:active-view-transition-type(page-exit):where(:not(:root:active-view-transition-type(page-enter))) { 88 | &::view-transition-new(root) { 89 | animation-name: none; 90 | z-index: -1; 91 | } 92 | } 93 | 94 | /* Only page-enter: only animate the new */ 95 | :root:active-view-transition-type(page-enter):where(:not(:root:active-view-transition-type(page-exit))) { 96 | &::view-transition-old(root) { 97 | animation-name: none; 98 | z-index: -1; 99 | } 100 | } 101 | 102 | /* Both page-enter and page-exit: queue new snapshot after all old, but not for first entry animation */ 103 | :root:active-view-transition-type(page-enter):active-view-transition-type(page-exit) { 104 | &::view-transition-group(root) { 105 | animation-duration: calc(var(--ie-page-transitions-exit-duration, 1s) + var(--ie-page-transitions-enter-duration, 1s)); 106 | } 107 | 108 | /* Play one after the other */ 109 | &::view-transition-old(root) { 110 | animation-duration: var(--ie-page-transitions-exit-duration, 1s); 111 | } 112 | &::view-transition-new(root) { 113 | animation-delay: var(--ie-page-transitions-exit-duration, 1s); 114 | animation-duration: var(--ie-page-transitions-enter-duration, 1s); 115 | } 116 | 117 | /* Allow control over the backdrop color */ 118 | &::view-transition { 119 | background-color: var(--page-transitions-backdrop-color, transparent); 120 | } 121 | } 122 | 123 | /* 0+1 – Rectangle */ 124 | @keyframes box { 125 | from { 126 | clip-path: polygon(0% 0%, 0% 100%, 100% 100%, 100% 0%); 127 | } 128 | to { 129 | clip-path: polygon(50% 50%, 50% 50%, 50% 50%, 50% 50%); 130 | } 131 | } 132 | @keyframes box--inverted { 133 | from { 134 | clip-path: polygon(0% 0%, 0% 100%, 0% 100%, 0% 0%, 100% 0%, 100% 100%, 0% 100%, 0% 100%, 100% 100%, 100% 0%); 135 | } 136 | to { 137 | clip-path: polygon(0% 0%, 0% 100%, 50% 100%, 50% 50%, 50% 50%, 50% 50%, 50% 50%, 50% 100%, 100% 100%, 100% 0%); 138 | } 139 | } 140 | 141 | /* 0 – Rectangle towards centre */ 142 | :root:active-view-transition-type(page-enter-effect-0) { 143 | &::view-transition-new(root) { 144 | animation-name: box--inverted; 145 | } 146 | } 147 | :root:active-view-transition-type(page-exit-effect-0) { 148 | &::view-transition-old(root) { 149 | animation-name: box; 150 | } 151 | } 152 | 153 | /* 1 – Rectangle from centre outwards */ 154 | :root:active-view-transition-type(page-enter-effect-1) { 155 | &::view-transition-new(root) { 156 | animation-name: box; 157 | animation-direction: reverse; 158 | } 159 | } 160 | :root:active-view-transition-type(page-exit-effect-1) { 161 | &::view-transition-old(root) { 162 | animation-name: box--inverted; 163 | animation-direction: reverse; 164 | } 165 | } 166 | 167 | /* 2+3 – Circle */ 168 | @property --ie-page-transitions-circle-actual-size { 169 | syntax: ""; 170 | inherits: false; 171 | initial-value: 0px; 172 | } 173 | @keyframes circle { 174 | from { 175 | --ie-page-transitions-circle-actual-size: 1px; /* Don’t start at 0px to prevent a glitch */ 176 | } 177 | to { 178 | --ie-page-transitions-circle-actual-size: 200vmax; 179 | } 180 | } 181 | :root:active-view-transition-type(page-enter-effect-2)::view-transition-new(root), 182 | :root:active-view-transition-type(page-exit-effect-2)::view-transition-old(root), 183 | :root:active-view-transition-type(page-enter-effect-3)::view-transition-new(root), 184 | :root:active-view-transition-type(page-exit-effect-3)::view-transition-old(root) { 185 | animation-name: circle; 186 | mask: 187 | url('data:image/svg+xml;utf8,') center / var(--ie-page-transitions-circle-actual-size) var(--ie-page-transitions-circle-actual-size) no-repeat, 188 | linear-gradient(#000 0 0) 189 | ; 190 | } 191 | 192 | /* 2 – Circle towards centre */ 193 | :root:active-view-transition-type(page-enter-effect-2) { 194 | &::view-transition-new(root) { 195 | animation-direction: reverse; 196 | mask-composite: exclude; 197 | } 198 | } 199 | :root:active-view-transition-type(page-exit-effect-2) { 200 | &::view-transition-old(root) { 201 | animation-direction: reverse; 202 | mask-composite: intersect; 203 | } 204 | } 205 | 206 | /* 3 – Circle from centre outwards */ 207 | :root:active-view-transition-type(page-enter-effect-3) { 208 | &::view-transition-new(root) { 209 | mask-composite: intersect; 210 | } 211 | } 212 | :root:active-view-transition-type(page-exit-effect-3) { 213 | &::view-transition-old(root) { 214 | mask-composite: exclude; 215 | } 216 | } 217 | 218 | /* 4+5+6+7 – Wipe */ 219 | @keyframes wipe-up { 220 | from { 221 | clip-path: polygon(0% 100%, 0% 100%, 100% 100%, 100% 100%); 222 | } 223 | to { 224 | clip-path: polygon(0% 0%, 0% 100%, 100% 100%, 100% 0%); 225 | } 226 | } 227 | @keyframes wipe-down { 228 | from { 229 | clip-path: polygon(0% 0%, 0% 0%, 100% 0%, 100% 0%); 230 | } 231 | to { 232 | clip-path: polygon(0% 0%, 0% 100%, 100% 100%, 100% 0%); 233 | } 234 | } 235 | @keyframes wipe-right { 236 | from { 237 | clip-path: polygon(0% 0%, 0% 100%, 0% 100%, 0% 0%); 238 | } 239 | to { 240 | clip-path: polygon(0% 0%, 0% 100%, 100% 100%, 100% 0%); 241 | } 242 | } 243 | @keyframes wipe-left { 244 | from { 245 | clip-path: polygon(100% 0%, 100% 100%, 100% 100%, 100% 0%); 246 | } 247 | to { 248 | clip-path: polygon(0% 0%, 0% 100%, 100% 100%, 100% 0%); 249 | } 250 | } 251 | 252 | /* 4 – Horizontal wipe from bottom to top */ 253 | :root:active-view-transition-type(page-enter-effect-4) { 254 | &::view-transition-new(root) { 255 | animation-name: wipe-up; 256 | } 257 | } 258 | :root:active-view-transition-type(page-exit-effect-4) { 259 | &::view-transition-old(root) { 260 | animation-name: wipe-down; 261 | animation-direction: reverse; 262 | } 263 | } 264 | 265 | /* 5 – Horizontal wipe from top to bottom */ 266 | :root:active-view-transition-type(page-enter-effect-5) { 267 | &::view-transition-new(root) { 268 | animation-name: wipe-down; 269 | } 270 | } 271 | :root:active-view-transition-type(page-exit-effect-5) { 272 | &::view-transition-old(root) { 273 | animation-name: wipe-up; 274 | animation-direction: reverse; 275 | } 276 | } 277 | 278 | /* 6 – Vertical wipe from left to right */ 279 | :root:active-view-transition-type(page-enter-effect-6) { 280 | &::view-transition-new(root) { 281 | animation-name: wipe-right; 282 | } 283 | } 284 | :root:active-view-transition-type(page-exit-effect-6) { 285 | &::view-transition-old(root) { 286 | animation-name: wipe-left; 287 | animation-direction: reverse; 288 | } 289 | } 290 | 291 | /* 7 – Vertical wipe from right to left */ 292 | :root:active-view-transition-type(page-enter-effect-7) { 293 | &::view-transition-new(root) { 294 | animation-name: wipe-left; 295 | } 296 | } 297 | :root:active-view-transition-type(page-exit-effect-7) { 298 | &::view-transition-old(root) { 299 | animation-name: wipe-right; 300 | animation-direction: reverse; 301 | } 302 | } 303 | 304 | /* 8+9 – Blinds */ 305 | @property --ie-page-transitions-blinds-actual-size { 306 | syntax: ""; 307 | inherits: false; 308 | initial-value: 0px; 309 | } 310 | @property --ie-page-transitions-blinds-target-size { 311 | syntax: ""; 312 | inherits: false; 313 | initial-value: 100px; 314 | } 315 | @property --ie-page-transitions-blinds-target-direction { 316 | syntax: "bottom | right"; 317 | inherits: false; 318 | initial-value: bottom; 319 | } 320 | @keyframes blinds { 321 | from { 322 | --ie-page-transitions-blinds-actual-size: 0px; 323 | } 324 | to { 325 | --ie-page-transitions-blinds-actual-size: var(--ie-page-transitions-blinds-target-size); 326 | } 327 | } 328 | :root:active-view-transition-type(page-enter-effect-8)::view-transition-new(root), 329 | :root:active-view-transition-type(page-exit-effect-8)::view-transition-old(root), 330 | :root:active-view-transition-type(page-enter-effect-9)::view-transition-new(root), 331 | :root:active-view-transition-type(page-exit-effect-9)::view-transition-old(root) { 332 | animation-name: blinds; 333 | mask: repeating-linear-gradient( 334 | to var(--ie-page-transitions-blinds-target-direction), 335 | #000000, 336 | #000000 var(--ie-page-transitions-blinds-actual-size), 337 | transparent 0, 338 | transparent var(--ie-page-transitions-blinds-target-size) 339 | ), linear-gradient(#000 0 0); 340 | } 341 | 342 | /* 8 – Horizontal Blinds */ 343 | :root:active-view-transition-type(page-enter-effect-8) { 344 | &::view-transition-new(root) { 345 | --ie-page-transitions-blinds-target-size: calc(100vw / 6); 346 | --ie-page-transitions-blinds-target-direction: right; 347 | mask-composite: intersect; 348 | } 349 | } 350 | :root:active-view-transition-type(page-exit-effect-8) { 351 | &::view-transition-old(root) { 352 | --ie-page-transitions-blinds-target-size: calc(100vw / 6); 353 | --ie-page-transitions-blinds-target-direction: right; 354 | mask-composite: exclude; 355 | } 356 | } 357 | 358 | /* 9 – Vertical Blinds */ 359 | :root:active-view-transition-type(page-enter-effect-9) { 360 | &::view-transition-new(root) { 361 | --ie-page-transitions-blinds-target-size: calc(100vh / 6); 362 | --ie-page-transitions-blinds-target-direction: bottom; 363 | mask-composite: intersect; 364 | } 365 | } 366 | :root:active-view-transition-type(page-exit-effect-9) { 367 | &::view-transition-old(root) { 368 | --ie-page-transitions-blinds-target-size: calc(100vh / 6); 369 | --ie-page-transitions-blinds-target-direction: bottom; 370 | mask-composite: exclude; 371 | } 372 | } 373 | 374 | /* 13+14 - Vertical Window */ 375 | @keyframes split-vertical { 376 | from { 377 | clip-path: polygon(50% 0%, 50% 100%, 50% 100%, 50% 0%); 378 | } 379 | to { 380 | clip-path: polygon(0% 0%, 0% 100%, 100% 100%, 100% 0%); 381 | } 382 | } 383 | @keyframes split-vertical--inverted { 384 | from { 385 | clip-path: polygon(0% 0%, 0% 100%, 50% 100%, 50% 0%, 50% 0%, 50% 100%, 100% 100%, 100% 0%); 386 | } 387 | to { 388 | clip-path: polygon(0% 0%, 0% 100%, 0% 100%, 0% 0%, 100% 0%, 100% 100%, 100% 100%, 100% 0%); 389 | } 390 | } 391 | 392 | /* 13 – Vertical Window Opening from middle to sides */ 393 | :root:active-view-transition-type(page-enter-effect-13) { 394 | &::view-transition-new(root) { 395 | animation-name: split-vertical--inverted; 396 | animation-direction: reverse; 397 | } 398 | } 399 | :root:active-view-transition-type(page-exit-effect-13) { 400 | &::view-transition-old(root) { 401 | animation-name: split-vertical; 402 | animation-direction: reverse; 403 | } 404 | } 405 | 406 | /* 14 – Vertical Window Opening from side to middle */ 407 | :root:active-view-transition-type(page-enter-effect-14) { 408 | &::view-transition-new(root) { 409 | animation-name: split-vertical; 410 | } 411 | } 412 | :root:active-view-transition-type(page-exit-effect-14) { 413 | &::view-transition-old(root) { 414 | animation-name: split-vertical--inverted; 415 | } 416 | } 417 | 418 | /* 17+18+19+20 - Strips */ 419 | @property --ie-page-transitions-strips-progress { 420 | syntax: ""; 421 | inherits: false; 422 | initial-value: 0%; 423 | } 424 | @property --ie-page-transitions-strips-angle { 425 | syntax: ""; 426 | inherits: false; 427 | initial-value: 0deg; 428 | } 429 | @keyframes strips { 430 | from { 431 | --ie-page-transitions-strips-progress: 0%; 432 | } 433 | to { 434 | --ie-page-transitions-strips-progress: 100%; 435 | } 436 | } 437 | :root:active-view-transition-type(page-exit-effect-17)::view-transition-old(root), 438 | :root:active-view-transition-type(page-enter-effect-17)::view-transition-new(root), 439 | :root:active-view-transition-type(page-exit-effect-18)::view-transition-old(root), 440 | :root:active-view-transition-type(page-enter-effect-18)::view-transition-new(root), 441 | :root:active-view-transition-type(page-exit-effect-19)::view-transition-old(root), 442 | :root:active-view-transition-type(page-enter-effect-19)::view-transition-new(root), 443 | :root:active-view-transition-type(page-exit-effect-20)::view-transition-old(root), 444 | :root:active-view-transition-type(page-enter-effect-20)::view-transition-new(root) { 445 | animation-name: strips; 446 | mask-image: linear-gradient( 447 | var(--ie-page-transitions-strips-angle), 448 | transparent, 449 | transparent var(--ie-page-transitions-strips-progress), 450 | black var(--ie-page-transitions-strips-progress), 451 | black 452 | ), linear-gradient(#000 0 0); 453 | } 454 | 455 | /* 17 - Strips left down */ 456 | :root:active-view-transition-type(page-enter-effect-17) { 457 | &::view-transition-new(root) { 458 | --ie-page-transitions-strips-angle: 225deg; 459 | mask-composite: exclude; 460 | } 461 | } 462 | :root:active-view-transition-type(page-exit-effect-17) { 463 | &::view-transition-old(root) { 464 | --ie-page-transitions-strips-angle: 225deg; 465 | mask-composite: intersect; 466 | } 467 | } 468 | 469 | /* 18 - Strips left up */ 470 | :root:active-view-transition-type(page-enter-effect-18) { 471 | &::view-transition-new(root) { 472 | --ie-page-transitions-strips-angle: 315deg; 473 | mask-composite: exclude; 474 | } 475 | } 476 | :root:active-view-transition-type(page-exit-effect-18) { 477 | &::view-transition-old(root) { 478 | --ie-page-transitions-strips-angle: 315deg; 479 | mask-composite: intersect; 480 | } 481 | } 482 | 483 | /* 19 - Strips right down */ 484 | :root:active-view-transition-type(page-enter-effect-19) { 485 | &::view-transition-new(root) { 486 | --ie-page-transitions-strips-angle: 135deg; 487 | mask-composite: exclude; 488 | } 489 | } 490 | :root:active-view-transition-type(page-exit-effect-19) { 491 | &::view-transition-old(root) { 492 | --ie-page-transitions-strips-angle: 135deg; 493 | mask-composite: intersect; 494 | } 495 | } 496 | 497 | /* 20 - Strips right down */ 498 | :root:active-view-transition-type(page-enter-effect-20) { 499 | &::view-transition-new(root) { 500 | --ie-page-transitions-strips-angle: 45deg; 501 | mask-composite: exclude; 502 | } 503 | } 504 | :root:active-view-transition-type(page-exit-effect-20) { 505 | &::view-transition-old(root) { 506 | --ie-page-transitions-strips-angle: 45deg; 507 | mask-composite: intersect; 508 | } 509 | } -------------------------------------------------------------------------------- /src/ie-page-transitions.mpa.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | import { extractParamsFromMetaTag, supportsViewTransitionsWithTypes } from './ie-page-transitions.shared.js'; 7 | 8 | // Configure the View Transition on PageReveal 9 | // If none exists, manually create one if the author specified a Page-Enter effect 10 | window.addEventListener('pagereveal', async (e) => { 11 | // Get Page-Enter Effect Meta Tag 12 | const $pageEnter = document.querySelector('meta[http-equiv="Page-Enter"]'); 13 | 14 | // This implementation needs View Transition Types 15 | if (!supportsViewTransitionsWithTypes()) return; 16 | 17 | // View Transition is about to happen! 18 | if (e.viewTransition) { 19 | 20 | // Page-Exit Effect: Get Duration and Effect 21 | const prevPageExitEffect = sessionStorage.getItem('prevPageExitEffect'); 22 | const prevPageExitDuration = sessionStorage.getItem('prevPageExitDuration'); 23 | 24 | // Page-Exit Effect: Set proper types 25 | if (prevPageExitDuration && prevPageExitEffect) { 26 | e.viewTransition.types.add('page-exit'); 27 | e.viewTransition.types.add(`page-exit-effect-${prevPageExitEffect}`); 28 | e.viewTransition.types.add(`page-exit-duration-${prevPageExitDuration}`); 29 | } 30 | 31 | // Page-Enter Effect 32 | if ($pageEnter && $pageEnter.getAttribute('content')) { 33 | const { duration, effect } = extractParamsFromMetaTag($pageEnter); 34 | 35 | // Set proper types 36 | e.viewTransition.types.add('page-enter'); 37 | e.viewTransition.types.add(`page-enter-effect-${effect}`); 38 | e.viewTransition.types.add(`page-enter-duration-${duration}`); 39 | } 40 | 41 | // Stop right here if no types determined or let the VT run 42 | if (e.viewTransition.types.size > 0) { 43 | e.viewTransition.types.add('page-transition'); 44 | } else { 45 | e.viewTransition.skipTransition(); 46 | } 47 | } 48 | 49 | // Page got accessed not coming from the same-origin or a reload or the like … 50 | else { 51 | if ($pageEnter && $pageEnter.getAttribute('content')) { 52 | // Hide body contents (old snapshot) 53 | document.documentElement.setAttribute('data-ie-page-transitions', ''); 54 | 55 | // Extract values 56 | const { duration, effect } = extractParamsFromMetaTag($pageEnter); 57 | 58 | // Manually start a View Transition 59 | const t = document.startViewTransition({ 60 | types: [ 61 | 'page-transition', 62 | 'page-enter', 63 | `page-enter-effect-${effect}`, 64 | `page-enter-duration-${duration}`, 65 | ], 66 | update: () => { 67 | // Show body contents again (new snapshot) 68 | document.documentElement.removeAttribute('data-ie-page-transitions'); 69 | } 70 | }); 71 | } else { 72 | // For some reason Safari doesn’t render the page contents on load. 73 | // The line below enforces Safari to re-render. 74 | document.documentElement.style.setProperty('--safari', 'bugfix'); 75 | } 76 | } 77 | }); 78 | 79 | // Communicate exit effect+duration from old page to new page on PageSwap 80 | window.addEventListener('pageswap', async (e) => { 81 | const $pageExit = document.querySelector('meta[http-equiv="Page-Exit"]'); 82 | 83 | // Page-Exit effect was set and VT is about to happen 84 | if (e.viewTransition && $pageExit && $pageExit.getAttribute('content')) { 85 | const { duration, effect } = extractParamsFromMetaTag($pageExit); 86 | 87 | // Persist in storage 88 | sessionStorage.setItem('prevPageExitDuration', duration); 89 | sessionStorage.setItem('prevPageExitEffect', effect); 90 | } 91 | 92 | // No Page-Exit 93 | else { 94 | sessionStorage.removeItem('prevPageExitDuration'); 95 | sessionStorage.removeItem('prevPageExitEffect'); 96 | } 97 | }); -------------------------------------------------------------------------------- /src/ie-page-transitions.shared.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | // Generate random number between min and max 7 | const randomInteger = (min, max) => { 8 | return Math.floor(Math.random() * (max - min + 1)) + min; 9 | } 10 | 11 | // Generate a random transition effect number 12 | const randomTransition = () => { 13 | const candidates = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 13, 14, 17, 18, 19, 20]; 14 | return candidates[randomInteger(0, candidates.length-1)]; 15 | } 16 | 17 | // Extract the duration and transition effect number from a meta tag element 18 | const extractParamsFromMetaTag = ($metaTagElement) => { 19 | let duration, effect; 20 | 21 | duration = /duration=(?\d+[\.\d+]*)/gmi.exec($metaTagElement.getAttribute('content'))?.groups?.duration ?? 1.0; 22 | duration = parseFloat(duration).toFixed(1).replace('.','_'); 23 | 24 | effect = /transition=(?\d+)/gmi.exec($metaTagElement.getAttribute('content'))?.groups?.transition ?? 0; 25 | if (effect == 23) effect = randomTransition(); 26 | 27 | return { 28 | duration, 29 | effect, 30 | }; 31 | } 32 | export { extractParamsFromMetaTag }; 33 | 34 | const supportsViewTransitionsWithTypes = () => { 35 | if (!document.startViewTransition) return false; 36 | if (!CSS.supports('selector(:active-view-transition-type(yes)')) return false; // @TODO: Use a different check 37 | 38 | return true; 39 | } 40 | export { supportsViewTransitionsWithTypes }; -------------------------------------------------------------------------------- /src/ie-page-transitions.spa.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | import { extractParamsFromMetaTag, supportsViewTransitionsWithTypes } from './ie-page-transitions.shared.js'; 7 | 8 | const supportsPageReveal = () => { 9 | return window.PageRevealEvent !== undefined; 10 | } 11 | 12 | const startViewTransition = (update = () => {}) => { 13 | if (!supportsViewTransitionsWithTypes()) { 14 | update(); 15 | return; 16 | }; 17 | 18 | const $pageEnter = document.querySelector('meta[http-equiv="Page-Enter"]'); 19 | const $pageExit = document.querySelector('meta[http-equiv="Page-Exit"]'); 20 | const types = []; 21 | 22 | // @TODO: Do a better check than just checking if [content] is set. 23 | // A better check would check for the `revealTrans(Duration=XX,Transition=XX)` pattern 24 | if ($pageEnter && $pageEnter.getAttribute('content')) { 25 | const { duration, effect } = extractParamsFromMetaTag($pageEnter); 26 | types.push('page-enter'); 27 | types.push(`page-enter-effect-${effect}`); 28 | types.push(`page-enter-duration-${duration}`); 29 | } 30 | 31 | if ($pageExit && $pageExit.getAttribute('content')) { 32 | const { duration, effect } = extractParamsFromMetaTag($pageExit); 33 | types.push('page-exit'); 34 | types.push(`page-exit-effect-${effect}`); 35 | types.push(`page-exit-duration-${duration}`); 36 | } 37 | 38 | if (types.length > 0) { 39 | types.push('page-transition'); 40 | } 41 | 42 | const t = document.startViewTransition({ 43 | update, 44 | types, 45 | }); 46 | 47 | return t; 48 | }; 49 | 50 | const init = () => { 51 | if (!supportsViewTransitionsWithTypes()) return; 52 | if (!supportsPageReveal()) return; 53 | 54 | const $pageEnter = document.querySelector('meta[http-equiv="Page-Enter"]'); 55 | 56 | if ($pageEnter) { 57 | // Hide body contents (old snapshot) 58 | document.documentElement.setAttribute('data-ie-page-transitions', ''); 59 | 60 | // Extract values from meta tag 61 | const { duration, effect } = extractParamsFromMetaTag($pageEnter); 62 | 63 | // Manually start a View Transition 64 | window.addEventListener('pagereveal', (e) => { 65 | const t = document.startViewTransition({ 66 | types: [ 67 | 'page-transition', 68 | 'page-enter', 69 | `page-enter-effect-${effect}`, 70 | `page-enter-duration-${duration}`, 71 | ], 72 | update: () => { 73 | // Show page contents again (new snapshot) 74 | document.documentElement.removeAttribute('data-ie-page-transitions'); 75 | } 76 | }); 77 | }); 78 | } 79 | }; 80 | export { init, startViewTransition }; --------------------------------------------------------------------------------