X一、背景菜单

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>Hello APP</title>
    <link rel="stylesheet" type="text/css" href="./css/api.css" />
    <style type="text/css">
    html,body{
        height: 100%;
    }
    *{
      padding: 0;
      margin: 0;
    }
    header {
        background-color: rgba(255, 64, 129, 1);
    }
    header ul li {
        height: 50px;
        line-height: 50px;
        text-align: center;
        display: none;
        color: #fff;
        font-size: 18px;
        width: 100%;
    }
    header ul li.active {
        display: block;
    }




    footer ul li:nth-child(1) {
        background: url(./image/bottombtn0201.png) no-repeat center top;
        background-size:30px 30px
    }

    footer ul li:nth-child(2) {
          background: url(./image/bottombtn0301.png) no-repeat center top;
          background-size:30px 30px
    }
    footer ul li:nth-child(3) {
          background: url(./image/bottombtn0401.png) no-repeat center top;
          background-size:30px 30px
    }

    footer ul li:nth-child(1).active {
             background-image: url(./image/bottombtn0202.png)!important;

    }

    footer ul li:nth-child(2).active {
             background-image: url(./image/bottombtn0302.png)!important;
    }

    footer ul li:nth-child(3).active {
             background-image: url(./image/bottombtn0102.png)!important;
    }



    footer{
          position: absolute;
          bottom: 0;
          left: 0;
          width: 100%;
          overflow: hidden;
          box-shadow: #d0cece 10px 0px 10px 2px ;
    }

    footer ul{
      display: -webkit-box;  /* 容器*/display: -webkit-flex;
      display: flex;
      -webkit-box-orient:horizontal;
      -webkit-flex-flow:row;
      flex-flow: row;
      overflow: hidden;
    }

    footer ul li{
      -webkit-box-flex:1;
      -webkit-flex:1;
      flex: 1;
      width: 100%;
      text-align: center;
      padding-top: 30px;
    }

    footer ul li i,span{
      margin: 0 auto;
      display: block;
    }

/*
    footer ul li i{
        width: 30px;
        height: 30px;
    }*/

    footer ul li span{
      padding-bottom: 4px;
    }


    </style>
</head>
<body>
<header id="header">
    <ul>
        <li class="border-b active">云API</li>
        <li class="border-b">端API</li>
        <li class="border-b">开发</li>
    </ul>
</header>

<footer id="footer">
    <ul>
      <li class="active" onclick="randomSwitchBtn( this );">
             <span>聊天</span>
      </li>
      <li onclick="randomSwitchBtn( this );">
             <span>订单</span>
      </li>
      <li  onclick="randomSwitchBtn( this );">
             <span>商城</span>
      </li>
    </ul>
</footer>


</body>
<script type="text/javascript" src="./script/api.js"></script>
<script type="text/javascript">
    apiready = function(){
        $api.fixStatusBar($api.dom('header'));
    };

    function randomSwitchBtn(tag) {
        //if (tag == $api.dom('#footer li.active')) return;
        var eFootLis = $api.domAll('#footer li');

          //  eHeaderLis = $api.domAll('header li'),
        index = 0;
        for (var i = 0, len = eFootLis.length; i < len; i++) {
            if (tag == eFootLis[i]) {
                index = i;
            } else {
                $api.removeCls(eFootLis[i], 'active');
                //$api.removeCls(eHeaderLis[i], 'active');
            }
        }
        $api.addCls(eFootLis[index], 'active');
        //$api.addCls(eHeaderLis[index], 'active');

    }
</script>
</html>

猜你喜欢

转载自blog.csdn.net/weixin_36792339/article/details/80773196
今日推荐