[JQuery] 컨텐츠 높이를 같게 하는 JQuery
<script type="text/javascript">
$.fn.setEqualHeight=function() {
var maxHeight=0;
var maxElement=null;
$(this).each(function(i) {
var hei = $(this).outerHeight();//padding,border값을 포함한 높이
if( hei > maxHeight ) {
maxHeight=hei;
maxElement=this;
}
});
$(this).not($(maxElement)).each(function() {
var rehei = maxHeight-($(this).outerHeight()- $(this).height());
$(this).height(rehei)
})
}
$(document).ready(function() {
$('.content1, .content2, content3......').setEqualHeight();
});
</script>
출처
http://defle.nayana.com/board/view.php?bbs_code=jquery&ot%5Bbd_view_count%5D=1&bd_num=1318
댓글
댓글 쓰기