123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>主页</title>
- <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="apple-mobile-web-app-status-bar-style" content="black">
- <link rel="stylesheet" href="css/mui.min.css">
- <style>
- html,
- body {
- background-color: black;
- }
-
- .mui-tab-label {
- color: white;
- }
-
- .mui-active {
- background-color: #eb4f53;
- }
- </style>
- </head>
- <body>
- <nav class="mui-bar mui-bar-tab" style="background-color: black;">
- <a id="one" class="mui-tab-item mui-active" href="main.html">
- <span class="mui-icon" style="background-image: url(images/dibutab/shouye.png);background-size: 24px;"></span>
- <span class="mui-tab-label">首页</span>
- </a>
- <a class="mui-tab-item" href="channel.html">
- <span class="mui-icon" style="background-image: url(images/dibutab/pindao.png);background-size: 24px;"></span>
- <span class="mui-tab-label">频道</span>
- </a>
- <a class="mui-tab-item" href="vip.html">
- <span class="mui-icon" style="background-image: url(images/dibutab/vip.png);background-size: 24px;"></span>
- <span class="mui-tab-label">vip</span>
- </a>
- <a class="mui-tab-item" href="personal.html">
- <span class="mui-icon" style="background-image: url(images/dibutab/wo.png);background-size: 24px;"></span>
- <span class="mui-tab-label">我</span>
- </a>
- </nav>
- <script src="js/mui.min.js"></script>
- <script type="text/javascript" charset="utf-8">
- //mui初始化
- mui.init({
- swipeBack: false //启用右滑关闭功能
- });
- var subpages = ['main.html', 'channel.html', 'vip.html', 'personal.html'];
- var subpage_style = {
- bottom: '51px'
- };
- var aniShow = {};
- //创建子页面,首个选项卡页面显示,其它均隐藏;
- mui.plusReady(function() {
- var self = plus.webview.currentWebview();
- for (var i = 0; i < 4; i++) {
- var temp = {};
- var sub = plus.webview.create(subpages[i], subpages[i], subpage_style);
- if (i > 0) {
- sub.hide();
- } else {
- temp[subpages[i]] = "true";
- mui.extend(aniShow, temp);
- }
- self.append(sub);
- }
- });
- //当前激活选项
- var activeTab = subpages[0];
- //选项卡点击事件
- mui('.mui-bar-tab').on('tap', 'a', function(e) {
- var targetTab = this.getAttribute('href');
- // var name = this.querySelector('.mui-tab-label').innerHTML;
- if (targetTab == activeTab) {
- return;
- }
- //显示目标选项卡
- //若为iOS平台或非首次显示,则直接显示
- if (mui.os.ios || aniShow[targetTab]) {
- plus.webview.show(targetTab);
- } else {
- //否则,使用fade-in动画,且保存变量
- var temp = {};
- temp[targetTab] = "true";
- mui.extend(aniShow, temp);
- plus.webview.show(targetTab, "fade-in", 300);
- }
- //隐藏当前;
- plus.webview.hide(activeTab);
- //更改当前活跃的选项卡
- activeTab = targetTab;
- });
- var backButtonPress = 0;
- mui.back = function(event) {
- backButtonPress++;
- if (backButtonPress > 1) {
- plus.runtime.quit();
- } else {
- plus.nativeUI.toast('再按一次退出应用');
- }
- setTimeout(function() {
- backButtonPress = 0;
- }, 1000);
- return false;
- };
- </script>
- </body>
- </html>
|