Bootstrap折叠。 如何一次只扩展一个div
我怎样才能一次展示一个?
演示: http : //jsfiddle.net/tvvq59wv/
$('.collapser').click(function() { $(this).next().collapse('toggle'); });
asfa asf asfasf afsf afsasf asf asf asf adf test asf afsas afsasf asf asf t1 asfa afsasf test sd sdgs sd asf asfas afasf asfasfgd asf afsas afsasf asf asf t1
提前致谢!
Bootstrap手风琴。 jQuery vs HTML-attributes
有两种方法可以解决您的问题。 您可以使用Javascript或分配HTML属性。 但首先我们简化了代码。
起点
-
col-md-4 col-xs-4
等于col-xs-4
。 - Bootstrap包含对齐类 。 您可以使用
text-right
类而不是style="text-align: right;"
。 - 请注意,
.row
类具有margin-right: -15px; margin-left: -15px;
属性margin-right: -15px; margin-left: -15px;
margin-right: -15px; margin-left: -15px;
。 你需要将.row
放在.container
或.container-fluid
。 -
style="height: 0px;"
是不必要的。collapse
类将display
属性设置为none
。 -
id
必须是唯一的。
让我们从这段代码开始:
https://jsfiddle.net/glebkema/a5q9mgho/
@import url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css'); .text { margin-bottom: 20px; padding: 15px; } .mauve { background: #c9f } .mint { background: #9fc } .peach { background: #fc9 } .text.mauve { background: #edf } .text.mint { background: #dfe } .text.peach { background: #fed }
left center right text left center right text left center right text