jquery 中 可以 这样判断 $(‘#test’).is(‘:animated’)
mootools中怎么做呢?

解决方案 »

  1.   

    mootools 1.3.2下,如果你用的是tween或者morph,用get方法取得元素上的动画对象。然后调这个动画对象的 isRunning 方法。
    如果你用的是mootools 1.2.5,你需要自己写代码给动画对象加个属性判断元素是否在动画执行中。
      

  2.   


    我试了。1.3.2 下
    alert( $$('ul').get('morph').isRunning ) //undefined
      

  3.   

    不了解,不过1楼说了是isRunning方法,调用时要加上“()”吧,即:isRunning();
      

  4.   

    试过了 
    貌似没有 isRunning() 这个方法.,
      

  5.   

    可怜的家伙,一直没别人搭理你吗?
    虽然你已经不来这里了,不过为了不让这个变成废贴,我还是贴出代码吧:<!DOCTYPE HTML>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>mootools running</title>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/mootools/1.3.2/mootools-yui-compressed.js"></script>
    <style>
    #test{
    width:100px;
    height:100px;
    background:#006;
    color:#fff;
    line-height:100px;
    vertical-align:middle;
    text-align:center;
    position:absolute;
    left:100px;
    top:200px;
    }
    </style>
    </head><body>
    <div id="state"></div>
    <div id="test">Click me !</div>
    <script type="text/javascript">
    window.addEvent('domready',function(){
    var node = $('test');
    var fx = node.get('morph');
    fx.setOptions({
    duration : 2000
    });
    var animate = function(){
    fx.start({
    'width' : '200px',
    'left' : '600px'
    }).chain(function(){
    fx.start({
    'width' : '100px',
    'left' : '100px'
    })
    });
    };
    node.addEvent('click', function(){
    if(fx.isRunning()){
    $('state').set('html', 'running');
    }else{
    $('state').set('html', 'stoped, let\'s start it.');
    animate();
    }
    });

    });
    </script>
    </body>
    </html>