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
广告