描述:反弹特效(Bounce Effect)反弹一个元素。当与隐藏或显示一起使用时,最后一次或第一次反弹会呈现淡入/淡出效果。

bounce

参数类型描述默认值
distanceNumber最大的反弹距离,以像素为单位。20
timesInteger元素反弹的次数。当隐藏或显示时,会为淡入/淡出效果添加半个反弹。5

实例

使用反弹特效(Bounce Effect)切换一个 div。

<!doctype html><html lang="en"><head>
  <meta charset="utf-8">
  <title>反弹特效(Bounce 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( "bounce", { times: 3 }, "slow" );});</script>
 </body></html>