• tab------左右布局


    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8" />
    <title></title>
    <style type="text/css">
    *{margin: 0;padding: 0;}
    #box{ 880px;height: 480px;border: 1px solid #ddd;margin: 100px auto;}
    #box .list{ 180px;border-right:1px solid #ddd ;height: 480px;float: left;}
    #box .list li{height: 45px;border-bottom:1px solid #ddd ;list-style: none;line-height: 45px;font-size: 16px;text-align: center;}
    #box .con{ 698px;height: 400px;background: #ccc;float: left;overflow: hidden;}
    #box .on{background: #ccc;}

    #box .con div{
    695px;height: 480px;font-size: 14px;text-align: center;
    }
    #box .con div:nth-child(1){
    background: palegreen;
    }
    #box .con div:nth-child(2){
    background:orange;
    }
    #box .con div:nth-child(3){
    background:palevioletred;
    }
    #box .con div:nth-child(4){
    background:blueviolet;
    }
    #box .con div:nth-child(5){
    background:brown ;
    }
    </style>
    </head>
    <body>
    <div id="box">
    <div class="list">
    <ul>
    <li class="on">哈哈</li>
    <li>嘻嘻</li>
    <li>喵喵</li>
    <li>某某</li>
    <li>喳喳</li>
    </ul>
    </div>
    <div class="con">
    <div>哈哈啊哈哈</div>
    <div>嘻嘻嘻嘻嘻嘻嘻</div>
    <div>喵喵密密麻麻</div>
    <div>某某某某某某</div>
    <div>扎扎扎扎咋呼咋哈</div>
    </div>
    </div>

    <script type="text/javascript" src="js/jquery-3.1.0.min.js" ></script>
    <script type="text/javascript">
    $(function(){
    var $li = $(".list li");
    var $conDiv = $(".con div");

    $li.mouseover(function(){
    var $index = $(this).index();
    $(this).addClass("on").siblings().removeClass("on");
    $conDiv.eq($index).show().siblings().hide();
    });
    })
    </script>
    </body>
    </html>

  • 相关阅读:
    关于vue中如何实现排到他思想
    js 文件下载
    js文件上传
    webpack学习笔记
    this总结
    React中props与state
    js事件总结
    js深拷贝与浅拷贝
    JS设计模式之观察者模式
    ES5与ES6的继承
  • 原文地址:https://www.cnblogs.com/qiyc/p/5886802.html
Copyright © 2020-2023  润新知