0
私のウェブサイトには、高さが動的に変化するセクションがあり、それにはテキストが含まれています。高さが変わるとテキストが半分になる
テキストの高さが変更されたときにテキストを非表示にするには、オーバーフローを非表示に設定します。
私が午前の問題は、あなたが
下の画像で見ることができるように、それは多くの場合、半分にテキストをカットすることで、それはまだそれをカットするように、これを変更するにはどのような方法がありますが、半分にそれはテキストがテキストbeignカットを停止切れ端オーバーフロー
HTML
<div style="overflow: hidden;" class="col-md-5 desktop-row-excerpt">
<a asp-controller="PressRelease" asp-action="GetPressRelease" [email protected][0].PressReleaseId>
<img class="img-responsive" src="@Model[0].HeaderImageUri">
<p>@Model[0].Title</p>
<div class="press-release-description-underscore"></div>
<p class="press-release-excerpt press-release-excerpt-1">@Model[0].Summary</p>
</a>
</div>
の前の行
それはあなたが
JS
//excerpt shortening functionality
$(document).ready(function() {
function resizeExcerpts() {
//resize containers to match 2 centerones on desktop module
var matchOneHeight = $('.excerpt-match-1').outerHeight();
$('.desktop-row-excerpt').outerHeight(matchOneHeight - 10);
var matchTwoHeight = $('.excerpt-match-2').outerHeight();
$('.desktop-row-excerpt-2').outerHeight(matchTwoHeight - 10);
}
$(window).resize(function() {
resizeExcerpts();
});
resizeExcerpts();
});
私はKieranmv95 @ピクセル値 – Kieranmv95
とページ上の他の要素の高さに高さを設定していて、あなたが私のJSを見ればどのようにこの作品は希望:私はJS-を追加しました私の答えに基づいています。 'parseInt($( 'div').css( 'line-height'))'を使ってline-heightの数値を取得し、そこから計算を実行することができます – TheThirdMan