zoukankan      html  css  js  c++  java
  • accordion

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>accordion</title>
        <script src="js/jquery-1.7.1.js"></script>
        <script src="js/sqLib.js"></script>
        <style>
            .accordion-panel{
                 400px;
    
            }
            .accordion-panel-heading{
                color: #d74147;
                 400px;
                height: 40px;
                line-height: 40px;
                border: 1px solid #d74147;
                margin: 5px 0;
                padding-left: 10px;
                border-radius: 5px;
            }
            .accordion-panel-content{
                display: none;
                border: 1px solid #000;
                 400px;
                border-radius: 5px;
                padding-left: 10px;
                line-height: 40px;
            }
        </style>
        <script>
            $(function(){
                $('.accordion-panel-heading').on('click',function(){
                    if($(this).hasClass('active')) {
                        $(this).removeClass('active');
                        $(this).siblings('.accordion-panel-content').slideUp('slow');
                    }
                    else {
                        $('.accordion .accordion-panel-heading').removeClass('active');
                        $('.accordion .accordion-panel-content').slideUp('slow');
                        $(this).addClass('active');
                        $(this).siblings('.accordion-panel-content').slideDown('slow');
                    }
                });
    
            });
        </script>
    </head>
    <body>
    <div class="accordion">
        <div class="accordion-panel">
            <div class="accordion-panel-heading">标题1</div>
            <div class="accordion-panel-content">内容1</div>
        </div>
        <div class="accordion-panel">
            <div class="accordion-panel-heading">标题2</div>
            <div class="accordion-panel-content">内容2</div>
        </div>
        <div class="accordion-panel">
            <div class="accordion-panel-heading">标题3</div>
            <div class="accordion-panel-content">内容3</div>
        </div>
        <div class="accordion-panel">
            <div class="accordion-panel-heading">标题4</div>
            <div class="accordion-panel-content">内容4</div>
        </div>
    
    </div>
    </body>
    </html>
    

      

  • 相关阅读:
    localhost/127.0.0.1:8080
    android要注意的小问题
    2016年度工作计划
    2016年度计划总结
    竞品分析的思路
    《竞品调研:抄也是一门学问》学习总结
    书籍名单
    2015年度计划-总结
    以前的博客
    和老板沟通学习记录
  • 原文地址:https://www.cnblogs.com/shenq/p/4924693.html
Copyright © 2011-2022 走看看