2015-07-11 3 views
0

Я пытаюсь добавить открытую каретку на аккордеон с использованием глифной бутстрапа, теперь я могу легко управлять, если есть только ссылка, но изменение в том, что я хочу, чтобы полный заголовок был доступен для кликабельности, вот мой код теперьДобавить open caret on bootstrap accordion

<div class="panel-group" id="accordion"> 
    <div class="panel panel-default"> 
    <div class="panel-heading" data-toggle="collapse" data-parent="#accordion" data-target="#collapseOne"> 
     <h4 class="panel-title"> 
     <a class="accordion-toggle"> 
      Collapsible Group Item #1 
     </a> 
     </h4> 
    </div> 
    <div id="collapseOne" class="panel-collapse collapse in"> 
     <div class="panel-body"> 
     Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. 
     </div> 
    </div> 
    </div> 
    <div class="panel panel-default"> 
    <div class="panel-heading"> 
     <h4 class="panel-title" data-toggle="collapse" data-parent="#accordion" data-target="#collapseTwo"> 
     <a class="accordion-toggle"> 
      Collapsible Group Item #2 
     </a> 
     </h4> 
    </div> 
    <div id="collapseTwo" class="panel-collapse collapse"> 
     <div class="panel-body"> 
     Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. 
     </div> 
    </div> 
    </div> 
    <div class="panel panel-default"> 
    <div class="panel-heading"> 
     <h4 class="panel-title" data-toggle="collapse" data-parent="#accordion" data-target="#collapseThree"> 
     <a class="accordion-toggle"> 
      Collapsible Group Item #3 
     </a> 
     </h4> 
    </div> 
    <div id="collapseThree" class="panel-collapse collapse"> 
     <div class="panel-body"> 
     Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS. 
     </div> 
    </div> 
    </div> 
</div> 

И работая скрипку http://jsfiddle.net/Tcgyx/15/

ответ

0

Добавьте это в CSS:

.panel-heading { 
     cursor: pointer; 
     position: relative; 
    } 

a { 
    text-decoration: none !important; 
} 

span.indicator { 
    position: absolute; 
    right: 5px; 
    top: 15px; 
} 

И <span class="glyphicon glyphicon-triangle-bottom indicator"></span> внутри <div class="panel-heading">

$(function(){ 
    $(".panel-heading") 
     .on("click",function(){ 
      $(".indicator").toggleClass("glyphicon-triangle-bottom glyphicon-triangle-left"); 
     }); 
}); 

При нажатии на .panel-heading переключает стрелку снизу слева.

+0

Он остается внизу, мне нужно идти слева, когда он закрыт? –

+0

Вы хотите, чтобы 'span.caret' переключался вверх и вниз по клику? – brroshan

+0

Я хочу быть на месте, когда открыт и указывать налево, когда он закрыт –