forked from thuasta/dream-runner
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex_1.html
More file actions
193 lines (179 loc) · 3.4 KB
/
index_1.html
File metadata and controls
193 lines (179 loc) · 3.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="0">
<meta http-equiv="Access-Control-Allow-Origin" content="*">
<meta http-equiv="x-rim-auto-match" content="none">
<meta name="format-detection" content="telephone=yes">
<meta name="screen-orientation" content="true">
<meta name="format-detection" content="telephone=no">
<meta name="full-screen" content="yes">
<meta name="x5-fullscreen" content="true">
<meta name="360-fullscreen" content="true">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="x5-page-mode" content="app">
<meta name="browsermode" content="application">
<title>DreamRunner</title>
<style>
html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video,
button {
margin: 0;
padding: 0;
font-style: normal;
}
/*禁止浏览器修改字体大小*/
html {
font-size: 12px;
}
html body {
-webkit-text-size-adjust: none !important;
-moz-text-size-adjust: none !important;
-ms-text-size-adjust: none !important;
text-size-adjust: none !important;
}
a {
text-decoration: none;
}
a:hover,
a:active,
a:visited,
a:link,
a:focus {
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
-webkit-tap-highlight-color: transparent;
outline: none;
}
body,
html {
height: 100%;
overflow: hidden;
position: relative;
top: 0px;
left: 0px;
}
.landscape-screen {
transform-origin: top left;
transform: rotate(90deg) translateY(-100%)
}
#Frame {
border-style: unset;
display: block
}
</style>
</head>
<body>
<iframe id="Frame" src="game.html"></iframe>
<script>
var orientation = window.orientation;
//开始时调用
var Frame = document.getElementById("Frame");
if (orientation == 180 || orientation == 0 || orientation == -180) {
//注意竖屏时要把 iframe的宽设置为当前窗口的高度 高设置为当前窗口的宽度
Frame.height = window.innerWidth;
Frame.width = window.innerHeight;
//通过css样式旋转90度
Frame.classList.add("landscape-screen");
} else {
//横屏时则正常
Frame.height = window.innerHeight;
Frame.width = window.innerWidth;
//通过移除类去掉css样式
Frame.classList.remove("landscape-screen");
}
//监听手机旋转事件 根据旋转状态设置旋转的css样式
window.onorientationchange = function () {
if (orientation == 180 || orientation == 0 || orientation == -180) {
Frame.classList.add("landscape-screen");
} else {
Frame.classList.remove("landscape-screen");
}
};
</script>
</body>
</html>