script.aculo.us - 震動效果


描述

震動效果會使目標元素水平來回移動三次,模擬頭部晃動。

此效果會忽略 duration 選項的任何設定。

語法

可以使用以下兩種形式之一來使用此效果 -

new Effect.Shake('id_of_element', [options]);
OR
new Effect.Shake(element, [options]);

特定於效果的引數

此效果沒有任何其他引數,除了 通用引數

示例

<html>
   <head>
      <title>script.aculo.us examples</title>
		
      <script type = "text/javascript" src = "/javascript/prototype.js"></script>
      <script type = "text/javascript" src = "/javascript/scriptaculous.js?load = effects" ></script>
		
      <script type = "text/javascript">
         function ShakeEffect(element){
            new Effect.Shake(element);
         }
      </script>
		
   </head>

   <body>
      <div id = "myimage" onclick = "ShakeEffect(this);">
         <img src = "/images/scriptaculous.gif" alt = "script.aculo.us" />
         <h2>Click me to Shake me out!</h2>
      </div>
   </body>
</html>

將生成以下結果 -

scriptaculous_effects.htm
廣告