2014-01-21 33 views
1

这是我自举3的数据切换手风琴

<a data-toggle="collapse" href="#collapsible-1">Digital</a> 

    <div id="collapsible-1"> 
     HTML stands for HyperText Markup Language. HTML is the main markup language for describing the structure of Web pages.</a> 
    </div> 

<a data-toggle="collapse" href="#collapsible-2">Radio</a> 

    <div id="collapsible-2"> 
     HTML stands for HyperText Markup Language. HTML is the main markup language for describing the structure of Web pages.</a> 
    </div> 

我用data-toggle boostrap显示和隐藏元素,但我有一些小问题,就这样,在加载网页时可折叠的内容始终可见的,即使我必须做双击关闭元素,之后是工作正常。你认为我必须做什么,以collapsabe元素的内容总是隐藏在页面加载?

回答

0

Bootstrap's documentation摘自:

用法
崩溃插件使用了几类来处理繁重:

.collapse隐藏内容
.collapse.in显示内容
。转换开始时添加了折叠,并在完成时删除

因此,在短期:<div id="collapsible-1" class='collapse'>

+0

好,还是老样子没有答案的内容,你能不能请添加代码? – Schneider

+0

您是否像我建议的那样将类'collapse'添加到您的div中? –

0

您需要的collapse类添加到div隐藏在默认情况下是这样

<a data-toggle="collapse" href="#collapsible-1">Digital</a> 

    <div id="collapsible-1" class="collapse"> 
     HTML stands for HyperText Markup Language. HTML is the main markup language for describing the structure of Web pages. 
    </div> 

<a data-toggle="collapse" href="#collapsible-2">Radio</a> 

    <div id="collapsible-2" class="collapse"> 
     HTML stands for HyperText Markup Language. HTML is the main markup language for describing the structure of Web pages. 
    </div> 

Js Fiddle Demo