简体   繁体   English

mootools fx.reveal

[英]mootools fx.reveal

I'm trying to do a simple show/hide transition for a message div using fx.reveal in mootools 1.4. 我正在尝试在mootools 1.4中使用fx.reveal对消息div进行简单的显示/隐藏过渡。 The effect works the first time, but not on subsequent clicks. 该效果是第一次生效,但不适用于随后的点击。

Any hints as to where I'm going wrong? 关于我要去哪里的任何提示吗?

http://jsfiddle.net/MYgH6/1/ http://jsfiddle.net/MYgH6/1/

var mytween = new Fx.Reveal(document.getElementById('mydiv'), {duration: 2500});

$('myclick').addEvent('click', function(){
    mymessage();
});

function mymessage(){
    var mymessage = document.getElementById('mydiv');

    mymessage.set('html','YO!');

    mytween.reveal();
    mytween.dissolve();
}
var mytween = new Fx.Reveal(document.getElementById('mydiv'), {
    duration: 1000,
    onComplete:function(){
        this.element.dissolve();
    }
});

$('myclick').addEvent('click', function(){
    mymessage();
});

function mymessage(){
    var mymessage = document.getElementById('mydiv');

    mymessage.set('html','YO!');

    mytween.reveal();
}

I know it's not best answer, as you specified using Fx.Reveal, but I'd use wink command http://mootools.net/docs/more/Fx/Fx.Reveal#Element:wink 我知道这不是最佳答案,正如您使用Fx.Reveal指定的那样,但是我会使用wink命令http://mootools.net/docs/more/Fx/Fx.Reveal#Element:wink

Like here: http://jsfiddle.net/zalun/MYgH6/5/ 就像这里: http : //jsfiddle.net/zalun/MYgH6/5/

var msg = document.getElementById('mydiv').hide();
$('myclick').addEvent('click', function() {
    msg.wink();
});

You can certainly specify the message within the function as you did before. 您当然可以像以前一样在函数中指定消息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM