typo3 bootstrap 手风琴 - 折叠初始元素

typo3 bootstrap accordion - collapse the initial element

请仅与 bootstrap 主题的 Typo3 有关。

我想在页面启动时关闭手风琴的所有元素。目前顶层元素is open like here

请理解,它仅与此语句class中的in有关

<div id="panel-425-0" class="panel-collapse collapse in"> 

但是在源代码中更改它会对我想避免的其他位置产生副作用。

所以我正在寻找一种解决方案来使用 CSS 或 javascript 进行关闭。

欢迎任何指导。

在这里试试这个

所以基本上你通过它的 Id 获取元素并重新设置它的 class 属性没有 'in' class.

<script>
    document.getElementById('panel-425-0').setAttribute('class','panel-collapse collapse');
</script>

为了完整起见,我自己的提醒以及可能有助于将完整 TS 放入模板的设置部分的人

# get some javascript into 
# for hiding the first accordion element

page.jsFooterInline.20 = TEXT
page.jsFooterInline.20.value = document.getElementById('accordion-....').setAttribute('class','panel-collapse collapse');