script.aculo.us——擠壓效果


描述

擠壓效果使目標元素在文件顯示中以垂直和水平方向按比例縮小到消失的動畫,同時保持其左上角固定。

淨視覺效果是該元素被擠壓到其左上角,然後消失。

語法

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

new Effect.Squish('id_of_element', [options]);
OR
new Effect.Squish(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 SquishEffect(element){
            new Effect.Squish(element, {duration:3});
         }

         function ShowImage(element){
            new Effect.Appear(element,{duration:1, from:1, to:1.0});
         }
      </script>
   </head>
   
   <body>
      <div onclick = "ShowImage('myimage')">
         Click me to display the image
      </div>
      <br />
		
      <div id = "myimage" onclick = "SquishEffect(this);">
         <img src = "/images/scriptaculous.gif" alt = "script.aculo.us" />
         <h2>Click me to Squish me out</h2>
      </div>
   </body>
</html>

指令碼將產生以下結果——

scriptaculous_effects.htm
廣告