MooTools - 四次过渡



展示带有输入、输出和输入输出事件的二次过渡。我们举一个例子,其中我们将一个 鼠标按下 事件添加到一个 div 元素以及二次事件。查看以下代码。

示例

<!DOCTYPE html>
<html>

   <head>
      <style>
         #quad_in {
            width: 100px;
            height: 20px;
            background-color: #F4D03F;
            border: 2px solid #808B96;
         }
         #quad_out {
            width: 100px;
            height: 20px;
            background-color: #F4D03F;
            border: 2px solid #808B96;
         }
         #quad_in-out {
            width: 100px;
            height: 20px;
            background-color: #F4D03F;
            border: 2px solid #808B96;
         }
      </style>
      
      <script type = "text/javascript" src = "MooTools-Core-1.6.0.js"></script>
      <script type = "text/javascript" src = "MooTools-More-1.6.0.js"></script>
      
      <script type = "text/JavaScript">
         window.addEvent('domready', function() {
            $('quad_in').addEvent('mousedown', function(event) {
               this.set('tween', {duration: 'long', transition: 'quad:in'});
               this.tween('width', [80, 400]);
            });
            
            $('quad_out').addEvent('mousedown', function(event) {
               this.set('tween', {duration: 'long', transition: 'quad:out'});
               this.tween('width', [80, 400]);
            });
            
            $('quad_in-out').addEvent('mousedown', function(event) {
               this.set('tween', {duration: 'long', transition: 'quad:in-out'});
               this.tween('width', [80, 400]);
            });
         });
      </script>
   </head>
   
   <body>
      <div id = "quad_in"> Quad : in</div><br/>
      <div id = "quad_out"> Quad : out</div><br/>
      <div id = "quad_in-out"> Quad : in-out</div><br/>
   </body>
   
</html>

你将收到以下输出 -

输出

mootools_fxoptions.htm
广告
© . All rights reserved.