zoukankan      html  css  js  c++  java
  • tab栏切换效果

    <!DOCTYPE html>
    <html>
    <head lang="en">
        <meta charset="UTF-8">
        <title></title>
        <style>
            * {
                padding: 0;
                margin: 0;
            }
            .box {
                width: 500px;
                height: 400px;
                border: 1px solid #ccc;
                margin: 100px auto;
                overflow: hidden;
            }
            ul {
                width: 600px;
                height: 40px;
                margin-left: -1px;
                list-style: none;
            }
            li {
                float: left;
                width: 101px;
                height: 40px;
                text-align: center;
                font: 600 18px/40px "simsun";
                background-color: pink;
                cursor: pointer;
            }
            span {
                display: none;
                width: 500px;
                height: 360px;
                background-color: yellow;
                text-align: center;
                font: 700 150px/360px "simsun";
            }
            .show {
                display: block;
            }
            .current {
                background-color: yellow;
            }
        </style>
    
        <script>
            window.onload = function () {
                var boxArr = document.getElementsByClassName("box");
                for(var i=0;i<boxArr.length;i++){
                    fn(boxArr[i]);
                }
                function fn(ele){
                    var liArr = ele.getElementsByTagName("li");
                    var spanArr = ele.getElementsByTagName("span");
                    for(var i=0;i<liArr.length;i++){
                        liArr[i].index = i;
                        liArr[i].onmouseover = function () {
                            for(var j=0;j<liArr.length;j++){
                                liArr[j].className = "";
                                spanArr[j].className = "";
                            }
                            this.className = "current";
                            spanArr[this.index].className = "show";
                        }
                    }
                }
            }
        </script>
    </head>
    <body>
    
        <div class="box">
            <ul>
                <li class="current">鞋子</li>
                <li>袜子</li>
                <li>帽子</li>
                <li>裤子</li>
                <li>裙子</li>
            </ul>
            <span class="show">鞋子</span>
            <span>袜子</span>
            <span>帽子</span>
            <span>裤子</span>
            <span>裙子</span>
        </div>
    
        <div class="box">
            <ul>
                <li class="current">鞋子</li>
                <li>袜子</li>
                <li>帽子</li>
                <li>裤子</li>
                <li>裙子</li>
            </ul>
            <span class="show">鞋子</span>
            <span>袜子</span>
            <span>帽子</span>
            <span>裤子</span>
            <span>裙子</span>
        </div>
    
        <div class="box">
            <ul>
                <li class="current">鞋子</li>
                <li>袜子</li>
                <li>帽子</li>
                <li>裤子</li>
                <li>裙子</li>
            </ul>
            <span class="show">鞋子</span>
            <span>袜子</span>
            <span>帽子</span>
            <span>裤子</span>
            <span>裙子</span>
        </div>
    
    </body>
    </html>
  • 相关阅读:
    MybatisProperties注册IOC容器和初始化
    Springboot源码之application.yaml读取过程
    DataSource的注册容器和初始化
    修改ha_config配置文件
    读书笔记--Python基础教程 001
    Python实现购物车小程序
    Python3实现三级菜单
    实现用户登录并且输入错误三次后锁定该用户
    day1-python 的基础部分
    翻译:《实用的Python编程》06_02_Customizing_iteration
  • 原文地址:https://www.cnblogs.com/sj1988/p/6590012.html
Copyright © 2011-2022 走看看