手风琴中的Twitter bootstrap手风琴不会崩溃

时间:2013-08-07 22:30:51

标签: php twitter-bootstrap accordion collapse

我正在使用twitter bootstrap创建一个手风琴,其中每个行项目包含另一个手风琴。下面的代码在手风琴内部创建了手风琴,但内部手风琴不会崩溃,我只是无法弄清楚原因。

$daysToBeShown: array(2) { [2]=> string(6) "Wednesday" [6]=> string(7) "Sunday" }

$teamForDaysArray: array(2) { ["Wednesday"]=> array(2) { [0]=> string(18) "09:00-09:30 (1022)" [1]=> string(18) "09:30-10:00 (1023)" } ["Sunday"]=> array(1) { [0]=> string(18) "16:10-16:50 (2033)" } }

<div class="accordion" id="accordion1">
<?php
foreach($daysToBeShown as $key => $value)
{
?>
  <div class="accordion-group">
    <div class="accordion-heading">
      <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion1" href="#collapse<?php echo $key;?>">
        <?php echo $value;?>
      </a>
    </div>
    <div id="collapse<?php echo $key;?>" class="accordion-body collapse">
      <div class="accordion-inner">
        <div class="accordion" id="accordion2">
<?php
foreach($teamForDaysArray[$value] as $keys => $valueInner)
{
?>
  <div class="accordion-group">
    <div class="accordion-heading">
      <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapse<?php echo $valueInner;?>">
        <?php echo $valueInner;?>
      </a>
    </div>
    <div id="collapse<?php echo $valueInner;?>" class="accordion-body collapse" style="height: 0px;">
      <div class="accordion-inner">
        ...
      </div>
    </div>
  </div>
  <?php
}
?>
</div>
      </div>
    </div>
  </div>
  <?php
}
?>
</div>

1 个答案:

答案 0 :(得分:0)

经过一些额外的测试后,我相信我已经找到了问题所在。原始id包含空格和括号。一旦我选择了没有空格和括号的id,它就可以正常工作。我不完全确定是否是空格,括号或两者,这使得accoridion行为不端,但我建议避免使用带有自举手风琴的那些。