滑动特效(Slide Effect)

收藏:0   阅读:30

jQuery UI API - 滑动特效(Slide Effect)

所属类别

特效(Effects)

用法

描述:把元素滑动出视区。

slide

参数 类型 描述 默认值
direction String 特效的方向。可能的值:"left"、"right"、"up"、"down"。 "both"
distance Number 特效的距离。默认为元素的高度(height)还是宽度(width)取决于 direction 参数。可以设置为小于元素的宽度(width)/高度(height)的任意整数。 元素的 outerWidth

实例

使用滑动特效(Slide Effect)切换一个 div。

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>滑动特效(Slide 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( "slide" );
});
</script>
 
</body>
</html>
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!