2016-08-11 3 views
1

enter image description here부트 스트랩 열 matchheights을 만들려면 어떻게해야합니까? 내가 부트 스트랩 열을 만들 수있는 방법

은 매 3 열 행을 퍼 팅하지 않고 matchheihts,이 열이 나는 내가 넣을 수 없습니다 행을 foreach는 PHP 데이터베이스에서입니다.

matchHeight를 사용했지만 작동하지 않는 경우 다른 대안이 있습니까?

$(function() { 
    $('.item').matchHeight(options); 
    byRow: byRow 
}); 


<script src="<?=base_url();?>assets/matcheight/jquery.matchHeight.js" 
    type="text/javascript"></script> 
+0

가능한 복제 [I는 부트 스트랩의 열이 모두 같은 높이를 할 수 있는가? (http://stackoverflow.com/questions/19695784/how-can-i-make-bootstrap-columns-all-the -same-height) – ankit

답변

2

flexbox을 사용하여 해결하십시오. 이 내용을 다음과 같이 컨테이너에 적용하십시오.

.container { 
    display: flex; 
    flex-wrap: wrap; 
} 

이 방법을 사용해보십시오. 감사!

+0

와우, 작동합니다! :)) 나는 이것을 2 일 동안 풀려고 노력했다. 감사합니다! –

+0

:) 멋진 답변을 받아 들일 수 있을까요? 감사! – kukkuz

+0

나는 대답이 단지 CSS의 2 줄이라고 믿지 않는다. 하하하. 다시 감사합니다! :) –

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>