Mootools Delay Problem

Ultimately, I try to delay the fade-out by 5 seconds (page load, fade out after 5 seconds). But now the code bit below throws the error "delay is not a function".

el.fade('out').get('tween').chain(function(){
    el.destroy();
}).delay(5000);
+3
source share
3 answers

This works where it elis a valid item. I used an element with an identifier demoitemto check it, therefore:

var el = $('demoitem');
(function(){
    el.fade('out').get('tween');
    el.destroy();
}).delay(5000);

delay () is a function that can be bound to functions, not to the HTMLElement chain.

+6
source

Delay is a function method that should work:

el.fade('out').get('tween').chain(function(){
    el.destroy();
}.delay(5000));
+1
source
(function(){
    var el = $('fade');
    el.fade('out').get('tween');
    el.destroy();
}).delay(5000);
0

Source: https://habr.com/ru/post/1722073/


All Articles