最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Mootools Delay Issue - Stack Overflow

programmeradmin6浏览0评论

I'm ultimately trying to delay the fade out by 5 seconds (page loads, 5 seconds later the fade out happens). But right now the bit of code below throwing a "delay is not a function" error.

el.fade('out').get('tween').chain(function(){
    el.destroy();
}).delay(5000);

I'm ultimately trying to delay the fade out by 5 seconds (page loads, 5 seconds later the fade out happens). But right now the bit of code below throwing a "delay is not a function" error.

el.fade('out').get('tween').chain(function(){
    el.destroy();
}).delay(5000);
Share Improve this question asked Nov 6, 2009 at 2:45 ShpigfordShpigford 25.4k61 gold badges167 silver badges262 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 6

This works where el is a valid element. I used an item with id of demoitem to test it, so:

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

delay() is a function which is can be chained to functions, not to the chain of an HTMLElement.

Delay is a function method, this should work:

el.fade('out').get('tween').chain(function(){
    el.destroy();
}.delay(5000));
(function(){
    var el = $('fade');
    el.fade('out').get('tween');
    el.destroy();
}).delay(5000);
发布评论

评论列表(0)

  1. 暂无评论