[英]How to collapse all the accordion by default in jquery?
i just need a little help about accordion. 我只需要一点关于手风琴的帮助。 What I want is how can I collapse all the accordion by default when the page is loaded?
我想要的是如何在加载页面时默认折叠所有的手风琴? My goal is to display all the accordion contents always.
我的目标是始终显示所有的手风琴内容。 How can I do that?
我怎样才能做到这一点? Here's what I did in my code.
这是我在代码中所做的。
<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>
try this : 尝试这个 :
Add the active: false option documentation 添加active:false选项文档
$("#accordion").accordion({collapsible: true, active: false });
尝试这个
$( ".selector" ).accordion( "option", "collapsible", true );
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.