css - How can I apply a view-transition to my sidebar only? - Stack Overflow
I'm talking about the new view-transition API for multi-page apps (MPA): /@view-transition
I put
@view-transition {
navigation: auto;
}
In my main CSS file, and put view-transition-name: sidebar;
on my sidebar element; I thought the view transitions would apply to elements with names, but it apparently it cross-fades the entire page.
How can I limit the effect to just my sidebar, but still work automatically when clicking an <a>
(i.e. without JS startViewTransition
)?
I'm talking about the new view-transition API for multi-page apps (MPA): https://developer.mozilla.org/en-US/docs/Web/CSS/@view-transition
I put
@view-transition {
navigation: auto;
}
In my main CSS file, and put view-transition-name: sidebar;
on my sidebar element; I thought the view transitions would apply to elements with names, but it apparently it cross-fades the entire page.
How can I limit the effect to just my sidebar, but still work automatically when clicking an <a>
(i.e. without JS startViewTransition
)?
1 Answer
Reset to default 0From the MDN:
The view-transition-name CSS property provides the selected element with a distinct identifying name (a
<custom-ident>
) and causes it to participate in a separate view transition from the root view transition — or no view transition if the none value is specified.
The root view transition (the whole page) is implicit and you cannot really remove it unless you update its animation to none
::view-transition-old(root),
::view-transition-new(root) {
animation: none;
}
And you probably need to define another animation for your sidebar
::view-transition-old(sidebar),
::view-transition-new(sidebar) {
animation: ...;
}
- 台北电脑展10大杀手级电脑硬件
- 台式电脑“玩”安卓(图)
- 大本营不保?美国安卓系统激活量超iOS
- Intel兵屯深圳,意欲何为?
- 导航APP软件免费“醉翁之意不在酒”
- 英特尔公布搭载其芯片的Windows 8平板电脑的硬件配置规范
- c++ - Changing STL container (std::string) values in debugger - Stack Overflow
- circom - Pedersen Commitment Homomorphic Addition Issue - Stack Overflow
- kotlin - Do I need Serialization to Transfer a MutableMap Between Minecraft Server and Client? If so, How Should I Serialize It?
- amazon ses - Is it possible to send a RawMessage using Apache Camel AWS SES? - Stack Overflow
- c++ - inlining failed in call to ‘always_inline’ ‘vld1q_u16’ - cross compiling Node.js for armv6 - Stack Overflow
- Power query performance (SOAP connector) very low on migrating from Excel to Power BI Desktop - Stack Overflow
- c - Segmentation fault when access mapped memory - Stack Overflow
- Blender Python Script isn't positioning meshes right from the image - Stack Overflow
- In Visual Studio 2022, Can not export and import new Project Template - Stack Overflow
- Is there a class Nethereum.Signer.Transaction? - Stack Overflow
- java - jOOQ transaction does not work as expected - Stack Overflow