在'崩溃'之间引导toogle '崩溃'基于设备

时间:2015-07-03 11:16:27

标签: jquery html5 css3 twitter-bootstrap-3

我有崩溃面板默认"崩溃" (扩展)它运作良好,但我想设置"崩溃" (缩小)手机/标签,我该怎样实现?引导程序中是否有任何内置功能?

<div class="container hero-spacer">
  <div class="row">
  <div class="col-md-12">
  <div class="panel panel-primary">
            <div class="panel-heading">
                <h4 class="panel-title fontboldx">
                    <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne"><span class="glyphicon glyphicon-collapse-down"></span> Information</a>
                </h4>
            </div>
            <div id="collapseOne" class="panel-collapse collapse in">
                <div class="panel-body">
                    <p>here details will come</p>
                </div>
            </div>
        </div>

Default

对于手机/标签我想获得如下图所示的输出

enter image description here

1 个答案:

答案 0 :(得分:0)

我通过简单的JS找到了解决方案如下..

以下代码必须在创建对象后放置(在正文关闭</body>之前更好的位置)

<script>
if ((screen.width>=1024) && (screen.height>=768)) {
 var x = document.getElementById("collapseOne");
 x.className = "panel-collapse collapse in"; 
}
else {
var x = document.getElementById("collapseOne");
 x.className = "panel-collapse collapse"; 
}
</script>