zoukankan      html  css  js  c++  java
  • tab切换

     
       
     *{
            padding: 0;margin: 0;
        }
        .all{
            width: 100%;overflow: hidden;
        }
        ul li{
            list-style: none;
        }
        .box{
            width: 400px;height: 30px;background: blue;color: #fff;
        }
        .box li{
            width: 100px;height: 30px;line-height: 30px;float: left;text-align: center;cursor: pointer;
        }
        .text{
            width: 400px;height: 300px;line-height: 300px;text-align: center;position: relative;
        }
        .text li{
            width: 400px;height: 300px;position: absolute;top: 0;left: 0;display: none;background: #eee;
        }
        .text li:nth-child(1){
            display: block;
        }
    <div class="all">
        <ul class="box">
            <li>北京</li>
            <li>上海</li>
            <li>山东</li>
            <li>陕西</li>
        </ul>
    
        <ul class="text">
            <li>
                北京的内容
            </li>
            <li>
                上海的内容
            </li>
            <li>
                山东的内容
            </li>
            <li>
                陕西的内容
            </li>
        </ul>
    </div>
    $(".box li").click(function(){
         var $index = $(this).index();
         $(".text").find("li").eq($index).css({"display":"block"}).siblings("li").css({"display":"none"})
    })
  • 相关阅读:
    poj 2262
    poj 1050
    poj 1730
    poj 1061
    【设计模式】简单工厂模式学习
    【待学】
    [设计模式]策略模式和单一职责
    Windows live writer 误删 草稿 恢复
    [Linq]Linq To Sql (2)
    MVC 学习日志1(上)
  • 原文地址:https://www.cnblogs.com/namehou/p/10150279.html
Copyright © 2011-2022 走看看