在 mootools 链中设置延迟

发布于 2025-01-04 09:07:13 字数 1965 浏览 0 评论 0原文

我一直在尝试设置一个 mootools 链以将其应用到网站中。所以,我已经做到了,但是,仍然...我需要在序列开始时设置延迟,我的意思是,在一切开始之前等待 5 秒,我尝试设置 .delay(5000) 但只是不起作用,请帮忙。谢谢,这是完整的代码:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
    <title>Probando chain de mootools</title>
    <script src="mootools.js" type="text/javascript"></script>

<script>


var ClaseChainEfecto = new Class({
    //implemento chain
    Implements: Chain,

    initialize: function(){
        this.efecto1 = new Fx.Tween('elem1', {
            property: 'opacity',
            duration: 1000,
            onComplete: function(){
                this.callChain();
            }.bind(this)
        });
        this.efecto2 = new Fx.Tween('elem2', {
            property: 'opacity',
            duration: 1000
        });
    },

    efectos: function(){
        this.chain(
            function(){ this.efecto1.start(1,0); },
            function(){ this.efecto2.start(0,1); }
        );
        this.callChain();
    }
});

window.addEvent("domready", function(){
    miClaseChainEfecto = new ClaseChainEfecto();
    miClaseChainEfecto.efectos();
});
</script>
<style type="text/css">
.miestilo1{
    float: left;
    width: 80px;
    background-color: 333399;
    color: #fff;
    padding: 15px;
    font-size: 14pt;
    margin: 15px;
    float:left;
    position:absolute;
}
.miestilo2{
    float: left;
    width: 80px;
    background-color: 333399;
    color: #fff;
    padding: 15px;
    font-size: 14pt;
    margin: 15px;
    visibility:hidden;
    opacity:0;
    float:left;
    position:absolute;
}
</style>
</head>

<body>
<div id="elem1" class="miestilo1">
HOLA!! estoy probando chain. Pongo esta capa con más texto para que se vea!!
</div>
<div id="elem2" class="miestilo2">
Esto es un segundo elemento. Que también tendrá su efecto!
</div>

</body>
</html>

i've been trying to set a mootools chain to apply it then in a site. So, i've done it but, still... i need to set a delay on the beggining of sequence, i mean like, wait for 5 seconds before everything starts, i've tried to set .delay(5000) but just doesn't work out, pleeaaase help. thanks, here's the full code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
    <title>Probando chain de mootools</title>
    <script src="mootools.js" type="text/javascript"></script>

<script>


var ClaseChainEfecto = new Class({
    //implemento chain
    Implements: Chain,

    initialize: function(){
        this.efecto1 = new Fx.Tween('elem1', {
            property: 'opacity',
            duration: 1000,
            onComplete: function(){
                this.callChain();
            }.bind(this)
        });
        this.efecto2 = new Fx.Tween('elem2', {
            property: 'opacity',
            duration: 1000
        });
    },

    efectos: function(){
        this.chain(
            function(){ this.efecto1.start(1,0); },
            function(){ this.efecto2.start(0,1); }
        );
        this.callChain();
    }
});

window.addEvent("domready", function(){
    miClaseChainEfecto = new ClaseChainEfecto();
    miClaseChainEfecto.efectos();
});
</script>
<style type="text/css">
.miestilo1{
    float: left;
    width: 80px;
    background-color: 333399;
    color: #fff;
    padding: 15px;
    font-size: 14pt;
    margin: 15px;
    float:left;
    position:absolute;
}
.miestilo2{
    float: left;
    width: 80px;
    background-color: 333399;
    color: #fff;
    padding: 15px;
    font-size: 14pt;
    margin: 15px;
    visibility:hidden;
    opacity:0;
    float:left;
    position:absolute;
}
</style>
</head>

<body>
<div id="elem1" class="miestilo1">
HOLA!! estoy probando chain. Pongo esta capa con más texto para que se vea!!
</div>
<div id="elem2" class="miestilo2">
Esto es un segundo elemento. Que también tendrá su efecto!
</div>

</body>
</html>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文