0

我只是需要一些关于手风琴的帮助。我想要的是如何在页面加载时默认折叠所有手风琴?我的目标是始终显示所有手风琴内容。我怎样才能做到这一点?这是我在代码中所做的。

  <script>
    $(function() {
      $( "#accordion" ).accordion({
         collapsible: true, 
         autoHeight: false, 
         active: false 
      });
    });
  </script>

<div id="accordion">
              <h3>MASTER LIST</h3>
                <div>
                    <?php

                        echo anchor('category_controller/homepage','Categories');
                        echo "<br />";

                        echo anchor('item_controller/index','Items');
                        echo "<br />";

                        echo anchor('supplier_controller/index','Suppliers');
                        echo "<br />";

                        echo anchor('product_controller/index','Product');
                        echo "<br />";

                        echo anchor('#','Customers');
                        echo "<br />";

                        echo anchor('#','Depot');
                        echo "<br />";

                        echo anchor('h2morders/view','Reports');
                        echo "<br />";

                    ?>
                </div>
              <h3>LIST</h3>
                <div>
                  <?php
                        echo anchor('pricelist_controller/index','Price List');
                  ?>
                </div>

              <h3>HISTORY</h3>
                <div>
                  <?php
                        echo anchor('pricelist_controller/price_history','Price History');
                  ?>

                </div>

              <h3>TRANSACTIONS</h3>
                <div>
                  <?php
                        echo anchor('#','Inventory');
                        echo "<br />";

                        echo anchor('#','Material Transfer');
                        echo "<br />";

                        echo anchor('#','Material Return');
                        echo "<br />";

                        echo anchor('#','Disposal');
                        echo "<br />";

                        echo anchor('#','Order');
                        echo "<br />";

                        echo anchor('#','Delivery Receipt');
                        echo "<br />";

                        echo anchor('#','Material Issuance');
                        echo "<br />";
                  ?>
                </div>

              <h3>LEDGERS</h3>
                <div>
                  <?php

                      echo anchor('c','Items Ledger');
                      echo "<br />";

                      echo anchor('c','General Ledger');
                      echo "<br />";


                  ?>
                </div>
          </div>
      </div>
4

3 回答 3

2

尝试这个 :

添加 active: false 选项文档

$("#accordion").accordion({collapsible: true, active: false });
于 2013-08-02T06:58:32.600 回答
0
$( ".selector" ).accordion( "option", "active", false);    

文档

将 active 设置为 false 将折叠所有面板。这要求可折叠选项为真。

于 2013-08-02T06:58:10.867 回答
0

尝试这个

$( ".selector" ).accordion( "option", "collapsible", true );
于 2013-08-02T07:02:10.337 回答