UNPKG

662 BJavaScriptView Raw
1/**
2 * 插入页面动画需要的样式
3 */
4export function loadAnimateStyle(ms = 300) {
5 const css = `
6.taro_router .taro_page {
7 position: absolute;
8 left: 0;
9 top: 0;
10 width: 100%;
11 height: 100%;
12 background-color: #fff;
13 transform: translate(100%, 0);
14 transition: transform ${ms}ms;
15 z-index: 0;
16}
17
18.taro_router .taro_page.taro_tabbar_page,
19.taro_router .taro_page.taro_page_show.taro_page_stationed {
20 transform: none;
21}
22
23.taro_router .taro_page.taro_page_show {
24 transform: translate(0, 0);
25}`;
26 const style = document.createElement('style');
27 style.innerHTML = css;
28 document.getElementsByTagName('head')[0].appendChild(style);
29}