script.aculo.us - 爆炸效果


說明

爆炸效果是由不透明度和縮放效果組合而成,導致元素脫離文件流,然後從其中心開始放大,同時逐漸消失成透明狀態。

最終的效果是該元素彷彿被一陣煙霧吹出頁面。

語法

這可以採用以下兩種形式來使用 -

new Effect.Puff('id_of_element', [options]);
OR
new Effect.Puff(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 PuffEffect(element){
            new Effect.Puff(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="PuffEffect(this);">
         <img src = "/images/scriptaculous.gif" alt = "script.aculo.us" />
         <h2>Click me to Puff me out</h2>
      </div>
   </body>
</html>

將產生如下結果 -

scriptaculous_effects.htm
廣告