• jquery伸缩框


    伸缩框

    <!DOCYPT html>
    <html>
    <head>
        <title></title>
        <script src="jquery-1.12.0.min.js"></script>
    </head>
    <style>
    * {
        margin: 0;
        padding: 0;
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        box-sizing: border-box;
    }
    
    body {
        background: #2d2c41;
        font-family: 'Open Sans', Arial, Helvetica, Sans-serif, Verdana, Tahoma;
    }
    
    ul {
        list-style-type: none;
    }
    
    a {
        color: #b63b4d;
        text-decoration: none;
    }
    
    /** =======================
     * Contenedor Principal
     ===========================*/
    h1 {
         color: #FFF;
         font-size: 24px;
         font-weight: 400;
         text-align: center;
         margin-top: 80px;
     }
    
    h1 a {
         color: #c12c42;
         font-size: 16px;
     }
    
     .accordion {
         width: 100%;
         max-width: 360px;
         margin: 30px auto 20px;
         background: #FFF;
         -webkit-border-radius: 4px;
         -moz-border-radius: 4px;
         border-radius: 4px;
     }
    
    .accordion .link {
        cursor: pointer;
        display: block;
        padding: 15px 15px 15px 42px;
        color: #4D4D4D;
        font-size: 14px;
        font-weight: 700;
        border-bottom: 1px solid #CCC;
        position: relative;
        -webkit-transition: all 0.4s ease;
        -o-transition: all 0.4s ease;
        transition: all 0.4s ease;
    }
    
    .accordion li:last-child .link {
        border-bottom: 0;
    }
    
    .accordion li i {
        position: absolute;
        top: 16px;
        left: 12px;
        font-size: 18px;
        color: #595959;
        -webkit-transition: all 0.4s ease;
        -o-transition: all 0.4s ease;
        transition: all 0.4s ease;
    }
    
    .accordion li i.fa-chevron-down {
        right: 12px;
        left: auto;
        font-size: 16px;
    }
    
    .accordion li.open .link {
        color: #b63b4d;
    }
    
    .accordion li.open i {
        color: #b63b4d;
    }
    .accordion li.open i.fa-chevron-down {
        -webkit-transform: rotate(180deg);
        -ms-transform: rotate(180deg);
        -o-transform: rotate(180deg);
        transform: rotate(180deg);
    }
    
    /**
     * Submenu
     -----------------------------*/
     .submenu {
         display: none;
         background: #444359;
         font-size: 14px;
     }
    
     .submenu li {
         border-bottom: 1px solid #4b4a5e;
     }
    
     .submenu a {
         display: block;
         text-decoration: none;
         color: #d9d9d9;
         padding: 12px;
         padding-left: 42px;
         -webkit-transition: all 0.25s ease;
         -o-transition: all 0.25s ease;
         transition: all 0.25s ease;
     }
    
     .submenu a:hover {
         background: #b63b4d;
         color: #FFF;
     }
    
    </style>
        <body>
    <ul id="accordion" class="accordion">
    
            <li>
    
                <div class="link"><i class="fa fa-paint-brush"></i>1<i class="fa fa-chevron-down"></i></div>
    
                <ul class="submenu">
    
                    <li><a href="#">1.1</a></li>
    
                    <li><a href="#">1.2</a></li>
    
                    <li><a href="#">1.3</a></li>
    
                    <li><a href="#">1.4</a></li>
    
                </ul>
    
            </li>
    
            <li>
    
                <div class="link"><i class="fa fa-code"></i>2<i class="fa fa-chevron-down"></i></div>
    
                <ul class="submenu">
    
                    <li><a href="#">2.1</a></li>
    
                    <li><a href="#">2.2</a></li>
    
                    <li><a href="#">2.3</a></li>
    
                </ul>
    
            </li>
    
            <li>
    
                <div class="link"><i class="fa fa-mobile"></i>3<i class="fa fa-chevron-down"></i></div>
    
                <ul class="submenu">
    
                    <li><a href="#">3.1</a></li>
    
                    <li><a href="#">3.2</a></li>
    
                    <li><a href="#">3.3</a></li>
    
                    <li><a href="#">3.4</a></li>
    
                </ul>
    
            </li>
    
            <li><div class="link"><i class="fa fa-globe"></i>4<i class="fa fa-chevron-down"></i></div>
    
                <ul class="submenu">
    
                    <li><a href="#">4.1</a></li>
    
                    <li><a href="#">4.2</a></li>
    
                    <li><a href="#">4.3</a></li>
    
                    <li><a href="#">4.4</a></li>
    
                </ul>
    
            </li>
    
        </ul>
    
    
        </body>
    </html>
    <script>
    $(function() {
        var Accordion = function(el, multiple) {
            this.el = el || {};
            this.multiple = multiple || false;
    
            // Variables privadas
            var links = this.el.find('.link');
            // Evento
            links.on('click', {el: this.el, multiple: this.multiple}, this.dropdown)
        }
    
        Accordion.prototype.dropdown = function(e) {
            var $el = e.data.el;
                $this = $(this),
                $next = $this.next();
    
            $next.stop().slideToggle();
            $this.parent().stop().toggleClass('open');
    
            if (!e.data.multiple) {
                $el.find('.submenu').not($next).slideUp().parent().removeClass('open');
            };
        }    
    
        var accordion = new Accordion($('#accordion'), false);
    });
    </script>
  • 相关阅读:
    Silverlight 学习笔记(二)silverligth 界面布局
    (C#)WinForm窗体间传值
    软件开发所需要的十三个文档
    XP下安装SQL2000企业版本(转载)
    .net 框架下快速Web开发(一)——纠结的里程
    .net MVC 框架调试过程中,产生大量的临时文件
    认识NHitenate
    如何循序渐进向.Net架构师发展[转载]
    核桃煲鸡汤
    .NET获取客户端信息 (C#)
  • 原文地址:https://www.cnblogs.com/wzzl/p/5371465.html
Copyright © 2020-2023  润新知