• 仿QQ下拉菜单


    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
    <title>仿QQ下拉菜单</title>
    <style type="text/css">
    *{
    padding:0px;
    margin:0px;
    font-family: microsoft yahei;
    }
    .container{
    margin: 20px;
    border:1px solid #000;
    240px;
    overflow: hidden;
    }
    li{
    list-style: none;
    }
    .container li{
    background: #63f7ff;
    240px;
    color:#000;
    font-size: 18px;
    cursor:pointer;
    line-height: 2em;
    }
    .container li span{
    0;
    height: 0;
    border-top: 5px solid transparent;
    border-left: 10px solid #000;
    border-bottom: 5px solid transparent;
    display: inline-block;
    margin: 0 10px;
    }
    .container li .down{
    0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 10px solid #000;
    }
    .small{

    }
    .small li{
    background: #fff;
    color:#000;
    border:1px solid #ddd;
    font-size: 16px;
    padding-left: 30px;
    }
    .small li:hover{
    background:#63f7ff;
    }
    .hide{
    display: none;
    }
    .container ul .color{
    background:#f7f794;
    }
    </style>
    </head>
    <script type="text/javascript">
    $(document).ready(function() {
    $('.container>ul>li').click(function(){
    $(this).toggleClass('color');
    $(this).find('span').toggleClass('down');
    $(this).next().toggleClass('hide');
    })
    });

    </script>

    <body>
    <div class="container">
    <ul>
    <li><span></span>我的好友</li>
    <ul class="small hide">
    <li>张三</li>
    <li>张三</li>
    <li>张三</li>
    </ul>
    <li><span></span>企业好友</li>
    <ul class="small hide">
    <li>李四</li>
    <li>李四</li>
    <li>李四</li>
    </ul>
    <li><span></span>黑名单</li>
    <ul class="small hide">
    <li>小二</li>
    <li>小二</li>
    <li>小二</li>
    </ul>
    </ul>
    </div>

    </body>
    </html>

  • 相关阅读:
    isteven-multi-select
    javascript学习之js对象和json对象(obj=JSON.parse(stu))
    jquery学习之路之元素类的切换toggle
    jquery学习之路之测验错题集
    jquery学习之路之核心函数
    jquery学习之路之选择过滤
    较完整的angularjs+bootstrap应用程序接口controller
    angularjs+requeirjs模块化的应用程序接口
    SIP协议参数详情
    SIP初步认识
  • 原文地址:https://www.cnblogs.com/ll-taj/p/5999855.html
Copyright © 2020-2023  润新知