私は 4 つの折りたたみ可能なセットを持っています。1 年の各四半期に 1 つの折りたたみ可能なセットです。現在の月によると、対応する折りたたみ可能ファイルはドキュメントの準備ができたときに展開する必要があります。ただし、これは機能していません。
<script type="text/javascript">
$(document).ready
(
function()
{
var today=new Date();
var month=today.getMonth()+1;
alert(month);
if(month>9)
{
$('#qFourCollapsible').trigger("expand");
}
else if(month>6)
{
$('#qThreeCollapsible').trigger("expand");
}
else if(month>3)
{
$('#qTwoCollapsible').trigger("expand");
}
else
{
alert("in else");
$('#qOneCollapsible').bind("expand", function () {
alert('Expanded');
});
}
}
);
</script>
<html>
<div data-role="collapsible-set" data-theme="b" data-content-theme="c" data-collapsed="false" id="qOneCollapsible">
<div data-role="collapsible">
<h2>January-March</h2>
<table id="quarterOneTable">
</table>
</div>
</div>
<div data-role="collapsible-set" data-theme="b" data-content-theme="d" id="qTwoCollapsible">
<div data-role="collapsible">
<h2>April-June</h2>
<table id="quarterTwoTable">
</table>
</div>
</div>
<div data-role="collapsible-set" data-theme="b" data-content-theme="c" id="qThreeCollapsible">
<div data-role="collapsible">
<h2>July-September</h2>
<table id="quarterThreeTable">
</table>
</div>
</div>
<div data-role="collapsible-set" data-theme="b" data-content-theme="d" id="qFourCollapsible">
<div data-role="collapsible">
<h2>October-December</h2>
<table id="quarterFourTable">
</table>
</div>
</div>
</html>
ご覧のとおり、折りたたみ式を 2 つの方法で拡張してみました。1: $('#qFourCollapsible').trigger("expand");
2: $('#qOneCollapsible').bind("expand", function () {
alert('Expanded');
どちらも機能していません。2番目の方法は機能しており、展開されたアラートは折りたたみ可能なものをクリックしたときにのみ表示されます。ただし、現在の月に応じてそれ自体を拡張したいと考えています。