script.aculo.us - 摺疊效果


描述

摺疊效果類似於擠壓效果,只不過縮放是按順序執行的,首先是豎直方向,然後是水平方向,給人一種元素先向上然後向一邊摺疊的感覺。

語法

以下兩種格式之一可用於使用此效果:-

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

這將生成以下結果:-

scriptaculous_effects.htm
廣告