-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
108 lines (93 loc) · 2.79 KB
/
index.html
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
<!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" />
<title></title>
<script src="js/mui.min.js"></script>
<link href="css/mui.min.css" rel="stylesheet"/>
<link rel="stylesheet" type="text/css" href="css/header.css"/>
<script type="text/javascript" charset="utf-8">
mui.init();
mui.plusReady(function() {
plus.navigator.setStatusBarStyle("light");
plus.navigator.setStatusBarBackground("#C9394A");
});
</script>
</head>
<body>
<header class="mui-bar mui-bar-nav title">
<h1 class="mui-title title-color"><b>微信</b></h1>
</header>
<nav class="mui-bar mui-bar-tab">
<a class="mui-tab-item mui-active" tabindex="0">
<span class="mui-icon mui-icon-weixin"></span>
<span class="mui-tab-label">微信</span>
</a>
<a class="mui-tab-item" tabindex="1">
<span class="mui-icon mui-icon-contact"></span>
<span class="mui-tab-label">通讯录</span>
</a>
<a class="mui-tab-item" tabindex="2">
<span class="mui-icon mui-icon-paperplane"></span>
<span class="mui-tab-label">发现</span>
</a>
<a class="mui-tab-item" tabindex="3">
<span class="mui-icon mui-icon-person"></span>
<span class="mui-tab-label">我</span>
</a>
</nav>
<script type="text/javascript">
var weixinArray = [
{
pageId: "weixin-chatlist.html",
pageUrl: "weixin-chatlist.html"
},
{
pageId: "weixin-contact.html",
pageUrl: "weixin-contact.html"
},
{
pageId: "weixin-discover.html",
pageUrl: "weixin-discover.html"
},
{
pageId: "weixin-me.html",
pageUrl: "weixin-me.html"
}
];
var weixinStyle = {
top: "44px",
bottom: "50px"
};
mui.plusReady(function() {
// 获取当前的webview对象
var indexWebview = plus.webview.currentWebview();
// 向当前的主页webview追加子页的4张webview对象
for (var i = 0; i < weixinArray.length; i++) {
var weixinPage = plus.webview.create(weixinArray[i].pageUrl,
weixinArray[i].pageId,
weixinStyle
);
// 隐藏webview窗口
weixinPage.hide();
// 追加每一个子页面到当前主页面
indexWebview.append(weixinPage);
}
plus.webview.show(weixinArray[0].pageId);
// 批量绑定tap事件,展示不同的页面
mui(".mui-bar-tab").on("tap", "a", function() {
var tabindex = this.getAttribute("tabindex");
// 显示点击的tab选项所对应的页面
plus.webview.show(weixinArray[tabindex].pageId, "fade-in", 200);
// 隐藏其他的不需要的页面
for (var i = 0; i < weixinArray.length; i++) {
if (i != tabindex) {
plus.webview.hide(weixinArray[i].pageId, "fade-out", 200);
}
}
});
});
</script>
</body>
</html>