帖子
帖子
用户
博客
课程
12
返回列表 发新帖
2
帖子
0
勋章
527
Y币
还是方案四好  引用了 IMG_1358.PNG   
7
帖子
0
勋章
301
Y币
楼主,我说小白能给个源码参考下不{:soso__3409329614010722382_4:}
0
帖子
0
勋章
4
Y币
OSChina 发表于 2016-10-14 00:03
给你几种方案:
1、原生模块。缺点:很多东西无法定制,受制于人。优点:简单快捷

是否方便贴个代码
1.png
0
帖子
0
勋章
4
Y币
渔夫11 发表于 2017-2-16 17:13
楼主,我说小白能给个源码参考下不{:soso__3409329614010722382_4:}

是不是有源码,可以贴一个不?
37
帖子
1
勋章
302
Y币
  1. <!DOCTYPE html>
  2. <html>

  3. <head>
  4.     <meta charset="utf-8">
  5.     <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
  6.     <title>title</title>
  7.     <link rel="stylesheet" type="text/css" href="../css/api.css" />
  8.     <style media="screen">
  9.         html,
  10.         body {
  11.             height: 100%;
  12.             background-color: white;
  13.         }

  14.         #container {
  15.             height: 100%;
  16.             display: flex;
  17.             display: -webkit-flex;
  18.             display: -webkit-box;
  19.         }

  20.         #container>.item {
  21.             width: 20%;
  22.             background-position: center;
  23.             background-repeat: no-repeat;
  24.             background-size: contain;
  25.             display: flex;
  26.             flex-direction: row;
  27.             flex-wrap: wrap;
  28.             justify-content: center;
  29.             align-items: flex-end;
  30.             margin-bottom: 5px;
  31.         }

  32.         #container>.item.item-shouye {
  33.             background-image: url(../image/all-gray.png);
  34.         }

  35.         #container>.item.item-shouye.active {
  36.             background-image: url(../image/all.png);
  37.             color: #FD7158;
  38.         }

  39.         #container>.item.item-faxian {
  40.             background-image: url(../image/favorite-gray.png);
  41.         }

  42.         #container>.item.item-faxian.active {
  43.             background-image: url(../image/favorite.png);
  44.             color: #FD7158;
  45.         }

  46.         #container>.item.item-xiaoxi {
  47.             background-image: url(../image/location-gray.png);
  48.         }

  49.         #container>.item.item-xiaoxi.active {
  50.             background-image: url(../image/location.png);
  51.             color: #FD7158;
  52.         }

  53.         #container>.item.item-wode {
  54.             background-image: url(../image/usercenter-gray.png);
  55.         }

  56.         #container>.item.item-wode.active {
  57.             background-image: url(../image/usercenter.png);
  58.             color: #FD7158;
  59.         }

  60.         .yinying2 {
  61.             -moz-box-shadow: 0px 2px 40px #595959;
  62.             -webkit-box-shadow: 0px 2px 40px #595959;
  63.             box-shadow: 0px 2px 40px #C0C0C0;
  64.         }
  65.     </style>
  66. </head>

  67. <body>
  68.     <div id="container">
  69.         <div class="item clearActive item-shouye active" onclick="randomSwitchBtn(this)">首页</div>
  70.         <div class="item clearActive item-faxian" onclick="randomSwitchBtn(this)">发现</div>
  71.         <div class="item">唱歌</div>
  72.         <div class="item clearActive item-xiaoxi" onclick="randomSwitchBtn(this)">消息</div>
  73.         <div class="item clearActive item-wode" onclick="randomSwitchBtn(this)">我的</div>
  74.     </div>
  75. </body>
  76. <script type="text/javascript" src="../script/api.js"></script>
  77. <script type="text/javascript">
  78.     apiready = function() {

  79.     };
  80.     //更换frame按钮
  81.     function randomSwitchBtn(tag) {
  82.         if (tag == $api.dom('.active')) return;
  83.         var eFootLis = $api.domAll('#container .clearActive'),
  84.             index = 0;
  85.         for (var i = 0, len = eFootLis.length; i < len; i++) {
  86.             if (tag == eFootLis[i]) {
  87.                 index = i;
  88.             } else {

  89.                 $api.removeCls(eFootLis[i], 'active');
  90.             }
  91.         }
  92.         $api.addCls(eFootLis[index], 'active');
  93.         api.setFrameGroupIndex({
  94.             name: 'group',
  95.             index: index
  96.         });
  97.     }
  98. </script>

  99. </html>
复制代码
/*底部导航代码*/
  1. <!DOCTYPE html>
  2. <html>

  3. <head>
  4.     <meta charset="utf-8">
  5.     <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
  6.     <title>title</title>
  7.     <link rel="stylesheet" type="text/css" href="../css/api.css" />
  8.     <style>
  9.         html,
  10.         body {
  11.             height: 100%;
  12.             background-color: transparent;
  13.         }
  14.         #diange-icon{
  15.             height: 100%;
  16.             background-position: center;
  17.             background-repeat: no-repeat;
  18.             background-size: contain;
  19.             background-image: url(../image/start.png);
  20.         }
  21.     </style>
  22. </head>

  23. <body>
  24.     <div id="diange-icon" onclick="fnOpenDiangeWin()">

  25.     </div>
  26. </body>
  27. <script type="text/javascript" src="../script/api.js"></script>
  28. <script type="text/javascript">
  29.     apiready = function() {

  30.     };
  31.     function fnOpenDiangeWin(){
  32.         //这里写点击中间的突出按钮后的事件

  33.     }
  34. </script>

  35. </html>
复制代码
/*中间突出按钮代码*/
  1. apiready = function() {
  2.         fnOpenFootFrame();
  3.         fnOpenDiangeFrame();
  4.     }
  5.     //打开点歌图标
  6.     function fnOpenDiangeFrame(){
  7.         api.openFrame({
  8.             name: 'index_diange_frame',
  9.             url: 'html/index_diange_frame.html',
  10.             rect: {
  11.                 x: (api.frameWidth - 130) / 2,
  12.                 y: api.frameHeight - 145,
  13.                 w: 130,
  14.                 h: 130
  15.             },
  16.             pageParam: {
  17.                 name: 'test'
  18.             },
  19.             bounces: false,
  20.         });

  21.     }
  22.     //打开底部导航条
  23.     function fnOpenFootFrame(){
  24.         api.openFrame({
  25.             name: 'index_foot_frame',
  26.             url: 'html/index_foot_frame.html',
  27.             rect: {
  28.                 x: 0,
  29.                 y: api.frameHeight - 110,
  30.                 w: 'auto',
  31.                 h: 110
  32.             },
  33.             bounces: false,
  34.             bgColor: 'rgba(0,0,0,0)',
  35.             vScrollBarEnabled: false,
  36.             hScrollBarEnabled: false
  37.         });

  38.     }
复制代码
/*首页打开底部导航代码*/
37
帖子
1
勋章
302
Y币
かれたそ時 发表于 2018-8-3 14:10
/*底部导航代码*/
/*中间突出按钮代码*/
/*首页打开底部导航代码*/

自己开新项目,也需要做突出导航的底部导航,这是我才写还没有写完的例子,不对之处请多包涵
0
帖子
0
勋章
3
Y币
这样的访问有个问题就是 几个frame页openFrame方法打开切换时中间的点歌图标 凸出部分会闪烁
12
您需要登录后才可以回帖 登录

本版积分规则