Search code examples
mootools

How to speed up Element.fade function


I'd like to speed up the fade() function, but the arguments the function accepts are about opacity, not speed. How can I do it?

Thanks


Solution

  • You can set a new tween duration like:

    $('slow').set('tween', {duration: 5000});
    $('fast').set('tween', {duration: 100});
    $$('div').fade();
    <script src="https://ajax.googleapis.com/ajax/libs/mootools/1.5.1/mootools-yui-compressed.js"></script>
    
    
    <div id="slow">I'm going to fade slowly!</div>
    <div id="normal">I'm going to fade normal speed!</div>
    <div id="fast">I'm going to fade fast!</div>

    jsFiddle: http://jsfiddle.net/8vjsfpfq/