如何正确使用嵌套手风琴?

时间:2015-08-29 17:57:34

标签: jquery css accordion

我最近开始做一些网络编程。所以是的,我是一个初学者,我希望我不会因为这个问题而受到抨击,这可能是一个微不足道的问题。我偶然发现了这个非常棒的手风琴教程,使用CSS和jQuery,我想在我的网页上使用它。我的问题是:

  1. 如何展示第一支手风琴始终有效? (显示:阻止;不是真正有效。当点击加载页面时,它关闭并打开手风琴1)

  2. 如何正确使用嵌套手风琴?

  3. 这里是code

    
    
        /*----- Accordion -----*/
            .accordion, .accordion * {
                box-sizing:border-box;
            	-moz-box-sizing:border-box;
            	-webkit-box-sizing:border-box;
            }
             
            .accordion {
                overflow:hidden;
                box-shadow:0px 1px 3px rgba(0,0,0,0.25);
                border-radius:3px;
            	-moz-border-radius:3px;
            	-webkit-border-radius:3px;
                background:#f9cf96;
            	color:#9d3528;
            }
             
            /*----- Section Titles -----*/
            .accordion-section-title {
                width:100%;
                padding:15px;
                display:inline-block;
                border-bottom:1px solid #1a1a1a;
                background:#f9cf96;
                transition:all linear 0.15s;
                /* Type */
                font-size:1.200em;
                color:#9d3528;
            	text-decoration:none;
            }
             
            .accordion-section-title.active, .accordion-section-title:hover {
                background:#f2a843;
                /* Type */
                text-decoration:none;
            }
             
            .accordion-section:last-child .accordion-section-title {
                border-bottom:none;
            }
             
            /*----- Section Content -----*/
            .accordion-section-content {
                padding:15px;
                display:none;
            }
        
        
    
    <div class="accordion">
    <div class="accordion-section">
    <a class="accordion-section-title" href="#accordion-1">Accordion 1</a>
    <div id="accordion-1" class="accordion-section-content" style="display:block;">
    <p style="text-indent:20px;">Some text here...</p>
                    									
    <a class="accordion-section-title" href="#accordion-2">Nested Accordion 1.1</a>
    <div id="accordion-2" class="accordion-section-content">
    <p>Some text here and photo gallery.</p>
    </div><!--end .accordion-section-content-nested-->
                    										
    </div><!--end .accordion-section-content-->
    </div><!--end .accordion-section-->
    </div><!--end .accordion-->
    &#13;
    $arr['animal'][] = 'Dog';
    $arr['animal'][] = 'Cat';
    $arr['insects'][] = 'Insect1';
    $arr['insects'][] = 'Insect2';
    
    $search_for = 'Cat';
    $search_result = [];
    
    while ($part = each($arr)) {
        $found = array_search($search_for, $part['value']);
        if(is_int($found)) {
            $fill = [ 'key1' => $part['key'], 'key2' => $found ];
            $search_result[] = $fill;
        }
    }
    
    echo 'Found '.count($search_result).' result(s)';
    print_r($search_result);
    
    &#13;
    &#13;
    &#13;

0 个答案:

没有答案