gpt4 book ai didi

javascript - jquery中如何默认折叠所有 Accordion ?

转载 作者:行者123 更新时间:2023-12-02 18:29:07 25 4
gpt4 key购买 nike

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

  <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>

最佳答案

试试这个:

添加 active: false 选项 documentation

$("#accordion").accordion({collapsible: true, active: false });

关于javascript - jquery中如何默认折叠所有 Accordion ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18010562/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com