如何在没有每三列放置行的情况下使引导列匹配,这些列来自我预设的数据库,所以我不能放行。
我使用了matchHeight但没有工作,还有其他替代方法吗?
$(function() {
$('.item').matchHeight(options);
byRow: byRow
});
<script src="<?=base_url();?>assets/matcheight/jquery.matchHeight.js"
type="text/javascript"></script>
答案 0 :(得分:2)
使用flexbox
解决此问题。将此应用于您的容器:
.container {
display: flex;
flex-wrap: wrap;
}
尝试一下,让我知道这是否适合你。谢谢!
答案 1 :(得分:0)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/x-javascript">
$(document).ready(function(){
// Select and loop the container element of the elements you want to equalise
$('.container').each(function(){
// Cache the highest
var highestBox = 0;
// Select and loop the elements you want to equalise
$('.col-md-4', this).each(function(){
// If this box is higher than the cached highest then store it
if($(this).height() > highestBox) {
highestBox = $(this).height();
}
});
// Set the height of all those children to whichever was highest
$('.col-md-4',this).height(highestBox);
});
});
</script>