apicloud中多个按钮的切换

纵然是瞬间 提交于 2019-12-08 03:35:14

如上图:话不多说,贴代码

<!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"/>
    <title>限时特卖</title>
   <!-- <link rel="stylesheet" type="text/css" href="../css/api.css"/>-->
    <link rel="stylesheet" type="text/css" href="../css/style.css"/>
     <link rel="stylesheet" type="text/css" href="../css/aui.css" />
    <style>
    #bgcolor{
    background-color: #f3f3f3;
    }
      #temai{
      height: 40px;
      width: 100%-20px;
      background: #FFFFFF;
      }
      .aui-tab {
       margin-bottom: 15px;
                  }
    </style>
</head>
<body id="bgcolor">
   <div id="temai">
 
    <ul>
     <li>
        <img src="../image/image_global_logo_home.png" style="height: 28px; margin: 1px;float: left;margin-top: 10px;" />
       <p style="font-size: 18px;margin-top: 20px; text-align: center;padding-top: 13px;">限时特卖</p>
     </li>
     </ul>
     </div>
 <div class="aui-tab">
        <ul class="aui-tab-nav" id="demo1">
            <li class="active">标签一</li>
            <li>标签二</li>
            <li>标签三</li>
             <li>标签四</li>
            <li>标签五</li>
            <li>标签六</li>
        </ul>
    </div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript">
      apiready = function () {
      //实现切换功能
        api.parseTapmode();
        var demo1 = $api.domAll("#demo1 li");
        for(var i in demo1){
            $api.addEvt(demo1[i], 'click', function(){
                $api.removeCls($api.dom("#demo1 li.active"),'active');
                $api.addCls(this,'active');
            });
            }
        }
</script>
</html>

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!