【问题标题】:typo3 bootstrap accordion - collapse the initial elementTyp3 引导手风琴 - 折叠初始元素
【发布时间】:2016-11-17 18:19:24
【问题描述】:
这仅与带有引导主题的 Typo3 相关。
我想在页面启动时关闭手风琴的所有元素。当前顶部元素 is open like here
请理解,它仅与本声明的class 中的in 相关
<div id="panel-425-0" class="panel-collapse collapse in">
但是在源代码中更改它会对我想避免的其他位置产生副作用。
所以我正在寻找一种使用 CSS 或 javascript 进行闭包的解决方案。
欢迎任何指导。
【问题讨论】:
标签:
twitter-bootstrap-3
accordion
typo3-7.6.x
【解决方案1】:
来试试这个
所以基本上你可以通过它的 Id 获取元素并重新设置它的类属性而不使用 'in' 类。
<script>
document.getElementById('panel-425-0').setAttribute('class','panel-collapse collapse');
</script>
【解决方案2】:
为了完整起见,我自己提醒一下,它可能有助于将完整的 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');