2015-02-07 6 views
0

Я хочу панель начальной загрузки с определенной высотой, где textoverflow в теле панели скрыт.Как реализовать расширяемый контент на панели начальной загрузки

Когда пользователь нажимает на визуальный элемент, реализованный в качестве выпадающего вклада внизу, содержимое расширяется.

Есть ли что-то встроенное в bootstrap, которое мне не хватает, или это лучше всего сделать, скользя самостоятельно?

<div class="panel panel-danger "> 
    <div class="panel-heading"> 
     <h3 class="panel-title">Welcome Bulletin</h3> 
    </div> 
    <div class="panel-body" style="height:100px; overflow:hidden"> 
     <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> 
     <p>There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.</p> 
    </div> 
</div> 

http://jsfiddle.net/Shred/Lm7md5bh/

ответ

0

Создать класс и использовать jquery toggleclass всякий раз, когда кнопка запуска нажата.

.panel-preview { 
    height: 100px; 
    overflow: hidden; 
} 

Вот jsfiddle.

Кроме того, Bootstrap имеет встроенный jquery plugin для переключения элементов. Однако это переключает свойство отображения элемента, а не высоту.

0

Я думаю, что вы ищете что-то вроде этого http://getbootstrap.com/javascript/#collapse-example-accordion

<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true"> 
<div class="panel panel-default"> 
<div class="panel-heading" role="tab" id="headingOne"> 
    <h4 class="panel-title"> 
    <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne"> 
     Collapsible Group Item #1 
    </a> 
    </h4> 
</div> 
<div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne"> 
    <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" role="tab" id="headingTwo"> 
    <h4 class="panel-title"> 
    <a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo"> 
     Collapsible Group Item #2 
    </a> 
    </h4> 
</div> 
<div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo"> 
    <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" role="tab" id="headingThree"> 
    <h4 class="panel-title"> 
    <a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree"> 
     Collapsible Group Item #3 
    </a> 
    </h4> 
</div> 
<div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree"> 
    <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> 

Смежные вопросы