ニュース セクションがあり、その左側に 1 つの大きな div (メイン記事) があり、右側にいくつかの (4) 小さな div (サブ記事) があります。それらを動的に等しくする必要があります(両側が視覚的に等しくなければなりません)
だから私はjqueryで作成しようとしましたが、部分的にこれを行いましたが、いくつかの本当に大きなバグがありました. 左側が小さすぎると、右側の記事が小さすぎてテキストがコンテナからはみ出します
HTMLは次のとおりです。
<div class="row">
<div class="col-md-6">
<article class="article-main_pg main-article article-main_pg--1">
<!-- image and text -->
</article>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="row">
<!-- this four times -->
<div class="col-lg-6">
<article class="article-main_pg main-article article-main_pg--1">
<!-- image and text -->
</article>
</div>
<!-- this four times end -->
</div>
</div>
</div>
私のJquery試行
// news section fix height
// get left news article height (without margin)
var leftArtHeight = $('.s10-news .main-article').outerHeight(false);
// reduce it by half and decrease by right side subarticles margin then add half of the margin (as we need to remember about 2 bottom subarticles margin)
// 25 is the margin (i know it, but ofcourse it can be set from DOM)
var heightForRightSubArt = (leftArtHeight / 2) - 25 + 13;
//finaly we set calculated height to the right subarticles and both sides are equal
$('.s10-news .sub-article').css("height" , heightForRightSubArt);
結果は問題ありませんが、反応が悪く、左側が小さすぎる場合はバグです。ここで助けを求めてください:(