Skip to content

Commit 305676b

Browse files
committed
add center page demo
1 parent 568732a commit 305676b

File tree

4 files changed

+110
-1
lines changed

4 files changed

+110
-1
lines changed

.DS_Store

0 Bytes
Binary file not shown.

center.html

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
6+
<meta name="apple-touch-fullscreen" content="yes">
7+
<meta name="apple-mobile-web-app-capable" content="yes">
8+
<meta name="full-screen" content="yes">
9+
<meta name="format-detection" content="telephone=no, address=no">
10+
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
11+
<meta http-equiv="Expires" content="-1">
12+
<meta http-equiv="pragram" content="no-cache">
13+
<meta http-equiv="Cache-Control" content="no-cache,must-revalidate">
14+
<title>垂直水平居中</title>
15+
<style type="text/css">
16+
html {
17+
height: 100%;
18+
font-size: 16px;
19+
}
20+
body {
21+
height: 100%;
22+
font-size: 14px;
23+
margin: 0;
24+
25+
}
26+
27+
.container {
28+
position: fixed;
29+
top: 0;
30+
left: 0;
31+
bottom: 0;
32+
right: 0;
33+
background: rgba(0, 0, 0, 0.85);
34+
z-index: 3;
35+
}
36+
37+
.box {
38+
display: table;
39+
height: auto;
40+
/*height: 50%;*/
41+
/* Set your own height: percents, ems, whatever! */
42+
width: 50%;
43+
/* Set your own width: percents, ems, whatever! */
44+
overflow: auto;
45+
/* Recommended in case content is larger than the container */
46+
margin: auto;
47+
/* Center the item vertically & horizontally */
48+
position: absolute;
49+
/* Break it out of the regular flow */
50+
top: 0;
51+
left: 0;
52+
bottom: 0;
53+
right: 0;
54+
/* Set the bounds in which to center it, relative to its parent/container */
55+
background: green;
56+
background: #4fa46b;
57+
color: #FFF;
58+
padding: 20px;
59+
border: solid 5px #2e5f3e;
60+
61+
}
62+
63+
64+
</style>
65+
</head>
66+
<body>
67+
<div class="container">
68+
<div class="box">aa</div>
69+
</div>
70+
71+
</body>
72+
</html>

enter renamed to enter.html

File renamed without changes.

modcode/openApp.js

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,41 @@ document.getElementById('openApp').onclick = function(e){
2424
window.setTimeout(function(){
2525
document.body.removeChild(ifr);
2626
},3000)
27-
};
27+
};
28+
29+
30+
31+
var log = function (msg){
32+
33+
}
34+
35+
var timeout,t=1000,hasApp=true;
36+
setTimeout(function(){
37+
if(hasApp){
38+
log('installed app');
39+
//node.hide()
40+
}else{
41+
log('not installed app');
42+
//node.show();
43+
//downloadApp()
44+
}
45+
},2000)
46+
47+
function testApp(){
48+
var t1 = Date.now();
49+
var ifr = document.createElement('iframe');
50+
ifr.src = 'com.baidu.tieba://'; //your app scheme
51+
document.body.appendChild(ifr);
52+
timeout = setTimeout(function(){
53+
try_to_open_app(t1)
54+
},t);
55+
}
56+
57+
function try_to_open_app(t1){
58+
var t2 = Date.now();
59+
if(!t1 || t2-t1 < t+200){
60+
////若启动应用,则js会被中断较长时间,超出此范围
61+
hasApp = false;
62+
}
63+
}
64+

0 commit comments

Comments
 (0)