# 5.9 練習

## 練習：內容展開縮合

先認識 scrollHeight：指的是某一個區塊裡面的內容高度。例：

寫法：

```javascript
var block_el = document.getElementById("block");
console.log(block_el.scrollHeight); // 區塊裡面的內容高度
```

{% embed url="<https://codepen.io/carlos411/pen/qBVVoZW>" %}

再來看內容的展開縮合：

{% embed url="<https://codepen.io/carlos411/pen/zYPPjWN>" %}

另外附上 jQuery 語法範例：<https://codepen.io/carlos411/pen/poLroKg>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.webmix.cc/javascript-web/5.-shi-jian/5.9-lian-xi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
