Latest web development tutorials

jQuery UI API – 百葉窗特效(Blind Effect)

所屬類別

特效(Effects)

用法

描述:百葉窗特效(Blind Effect)通過將元素包裹在一個容器內,採用"拉百葉窗"效果來隱藏或顯示元素。

blind

参数 类型 描述 默认值
direction String 隐藏元素时拉动百叶窗的方向,显示元素时拉动百叶窗的方向。
可能的值:up、down、left、right、vertical、horizontal。
"up"

容器應用overflow: hidden時,高度的變化會影響到元素的可見性。

實例

使用百葉窗特效(Blind Effect)切換一個div。

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>百葉窗特效(Blind Effect)演示</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
  <style>
  #toggle {
    width: 100px;
    height: 100px;
    background: #ccc;
  }
  </style>
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
</head>
<body>
 
<p>點擊任意地方進行切換。 </p>
<div id="toggle"></div>
 
<script>
$( document ).click(function() {
  $( "#toggle" ).toggle( "blind" );
});
</script>
 
</body>
</html>