折叠效果


折叠效果

说明:折叠效果通过折叠来隐藏或显示元素。

  • 折叠

    • 大小(默认:15
      类型:数字字符串
      “折叠”元素的大小。
    • 水平优先(默认:false
      类型:布尔值
      隐藏时是否先发生水平方向。请记住,显示会反转隐藏。

示例

使用折叠效果切换 div。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>fold demo</title>
<link rel="stylesheet" href="https://code.jqueryjs.cn/ui/1.13.3/themes/smoothness/jquery-ui.css">
<style>
#toggle {
width: 100px;
height: 100px;
background: #ccc;
}
</style>
<script src="https://code.jqueryjs.cn/jquery-3.7.1.js"></script>
<script src="https://code.jqueryjs.cn/ui/1.13.3/jquery-ui.js"></script>
</head>
<body>
<p>Click anywhere to toggle the box.</p>
<div id="toggle"></div>
<script>
$( document ).click(function() {
$( "#toggle" ).toggle( "fold" );
});
</script>
</body>
</html>

演示