视图转换 API 在 Microsoft Edge 122 或 macOS 上的 Opera 中不起作用,但在 Chrome 中完美工作

问题描述 投票:0回答:1

视图转换 API 适用于 Google Chrome,但不适用于 Microsoft Edge 122。根据兼容性表,这两种浏览器都应受支持。我正在使用 macOS。不涉及 JavaScript。只需使用这两个 HTML 文件即可在 Chrome 中运行。

单击图像时,

index.html
页面将导航至
child.html
页面。
child.html
页面具有相同的图像,但更大,并且视图转换 API 在 Chrome 中运行良好,因为它可以处理尺寸差异。

这是我的 HTML 文件:

index.html

<meta name="view-transition" content="same-origin">

<a href="child.html">
    <img class="img-small" src="https://images.rawpixel.com/image_800/cHJpdmF0ZS9sci9pbWFnZXMvd2Vic2l0ZS8yMDIyLTA1L3NrOTc5MS1pbWFnZS1rd3Z1amE5Ni5qcGc.jpg">
</a>

<style>
    .img-small {
        view-transition-name: small;
        width: 600px;
    }
</style>

child.html

<meta name="view-transition" content="same-origin">

<a href="index.html">
    <img class="img-small" src="https://images.rawpixel.com/image_800/cHJpdmF0ZS9sci9pbWFnZXMvd2Vic2l0ZS8yMDIyLTA1L3NrOTc5MS1pbWFnZS1rd3Z1amE5Ni5qcGc.jpg">
</a>

<body></body>

<style>
    .img-small {
        view-transition-name: small;
        width: 900px;
    }
</style>

你知道问题出在哪里吗? 谢谢!

google-chrome microsoft-edge view-transitions-api
1个回答
0
投票

您可能已启用 Chrome 标志:chrome://flags/#view-transition-on-navigation。这就是为什么它可以在 Chrome 而不是 Microsoft Edge 中运行而无需任何 JavaScript 代码。

不幸的是,Microsoft Edge 目前没有此标志,因此视图转换不起作用。您可能希望将来添加此标志。您还可以在 Microsoft Edge 中发送反馈 (Alt+Shift+I) 来请求此标志。

© www.soinside.com 2019 - 2024. All rights reserved.