2017-03-09 45 views
2

我有一個可摺疊面板,但我希望它在默認情況下不會摺疊。默認引導程序未摺疊面板

<div class="panel panel-default"> 
    <div class="panel-heading"> 
     <h4 class="panel-title"> 
      <a data-toggle="collapse" href="#collapse1"> 
       <span class="glyphicon glyphicon-collapse-down"> </span>1st Round</a> 
     </h4> 
    </div> 
    <div id="collapse1" class="panel-collapse collapse"> 
     <div class="panel-body">First round details</div> 

    </div> 
</div> 

如果我從

<div id="collapse1" class="panel-collapse collapse"> 

它的工作原理去除崩潰,但第一次點擊來uncollapse不起作用。

回答

6

「中的」添加類的可摺疊DIV

<div id="collapse1" class="panel-collapse collapsing in"> 

這將讓您的DIV默認打開。

+1

在4.0版本,使用「show」。 – aliawadh980

2

添加類in到面板ID collapse1像下面

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> 
 
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/> 
 

 
<div class="panel panel-default"> 
 
    <div class="panel-heading"> 
 
     <h4 class="panel-title"> 
 
      <a data-toggle="collapse" href="#collapse1"> 
 
       <span class="glyphicon glyphicon-collapse-down"> </span>1st Round</a> 
 
     </h4> 
 
    </div> 
 
    <div id="collapse1" class="panel-collapse collapse in"> 
 
     <div class="panel-body">First round details</div> 
 

 
    </div> 
 
</div>

0

你可以使用一些是取消對窗口負荷此次被類

$(window).load(fumction() { 
    $("#collapse1").removeClass("collapse"); 
});