Changes for page 学校ページ テンプレート
Last modified by Super Admin on 2026/04/05 18:59
From version
67.1
edited by Super Admin
on 2026/03/18 11:26
on 2026/03/18 11:26
Change comment:
There is no comment for this version
To version
68.1
edited by Super Admin
on 2026/03/18 11:28
on 2026/03/18 11:28
Change comment:
There is no comment for this version
Summary
Details
- Page properties
-
- Content
-
... ... @@ -1075,14 +1075,15 @@ 1075 1075 document.querySelectorAll('.activity-thread-header').forEach(function(header) { 1076 1076 header.addEventListener('click', toggleThreadExpand); 1077 1077 }); 1078 - // 長文投稿の折りたたみ初期化 1078 + // 長文投稿の折りたたみ初期化(max-height: 12em 超で省略) 1079 1079 document.querySelectorAll('.thread-post-body').forEach(function(body) { 1080 - // 先にtruncatedを仮適用してline-clampを有効にし、高さの差分で判定1080 + // pre-wrapのまま高さを測定し、max-height(12em ≒ ~200px)を超える場合に折りたたむ 1081 1081 var fullH = body.scrollHeight; 1082 + // 12em を px に変換(font-size × line-height × 行数 の近似値ではなくCSSと同じ値を取得) 1082 1082 body.classList.add('truncated'); 1083 - var clampedH = body.clientHeight;1084 + var maxH = body.clientHeight; // max-height: 12em 適用後の高さ 1084 1084 body.classList.remove('truncated'); 1085 - if (fullH > clampedH* 1.3+20) {1086 + if (fullH > maxH + 30) { 1086 1086 body.classList.add('truncated'); 1087 1087 var btn = document.createElement('button'); 1088 1088 btn.className = 'btn-read-more';