我正在寻找的这个Bootstrap技巧可以表达如下。让我们说我们有两行包含几个面板。当一个面板被解雇时,我希望看到相邻面板自动填充前一个面板占用的空间。例如:如果左侧的面板被解除,则右侧的面板向左移动。这有点像iPhone,当一个App图标被解雇时,其余的重新洗牌。我在互联网上搜索了一段时间没有成功。
仅供参考,我当前布局的一部分如下所示:
<div class="row">
<div class="panel-group" id="contentPanel">
<div class="col-sm-3 col-md-3" style="">
<div class="panel panel-info" id="indexPanel">
<div class="panel-heading">
<div class="panel-title">
<span id="indexPanelHeading">Panel 1</span>
<button type="button" class="close" data-target="#indexPanel" data-dismiss="alert">
<span class="pull-right clickable">
<i id="" class="glyphicon glyphicon-remove"></i>
</span>
</button>
</div>
</div> <!--end of panel-heading -->
<div class="panel-body">
<h4>Some texts </h4>
</div>
</div>
</div>
<!--another panel -->
<div class="col-sm-3 col-md-3" style="">
<div class="panel panel-info" id="indexPanel2">
<div class="panel-heading">
<div class="panel-title">
<span id="indexPanelHeading2">Panel 2</span>
<button type="button" class="close" data-target="#indexPanel2" data-dismiss="alert">
<span class="pull-right clickable">
<i id="" class="glyphicon glyphicon-remove"></i>
</span>
</button>
</div>
</div> <!--end of panel-heading -->
<div class="panel-body">
<h4>Some texts</h4>
</div>
</div>
</div>
</div>
</div>
答案 0 :(得分:1)
当面板被解除时,使用jQuery删除父col-*
。
$('.close').click(function(e){
e.stopPropagation();
var $target = $(this).parents('.col-sm-3');
$target.hide('slow', function(){ $target.remove(); });
});
http://www.codeply.com/go/eWpdCAJsHr
动态创建cols的示例..