add _extensions
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const title = document.querySelector("section#title-slide h1.title");
|
||||
if (!title) return;
|
||||
|
||||
const lineHeight = parseFloat(getComputedStyle(title).lineHeight);
|
||||
const maxHeight = lineHeight * 1.5; // 限制为两行
|
||||
|
||||
let fontSize = parseFloat(getComputedStyle(title).fontSize);
|
||||
|
||||
// 循环缩小字体直到标题高度 <= 两行
|
||||
while (title.scrollHeight > maxHeight && fontSize > 10) {
|
||||
fontSize -= 1;
|
||||
title.style.fontSize = fontSize + "px";
|
||||
}
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user