开发者

Fade-to certain opacity using dojo

I'm using 开发者_JAVA百科dojo toolkit. (version 1.6) I'm unable to stop the fading effect at certain opacity (say 0.5) Here is the code I'm using

 var fadeArgs = {node: "disabled_div", duration: 3000};
 dojo.style("disabled_div", "opacity", "0"); 
 dojo.fadeIn(fadeArgs).play();

But the above code is fading the element's opacity from 0 to 1. My requirement is to stop fading effect at 0.5 opacity.

Please help me out

Thanks in advance! SuryaPavan


you may try like this:

    var w = dojo.animateProperty({
    node:"disabled_div",
            duration: 3000,
    properties: {
        opacity: 0     
    },
    onAnimate:function(a){
        if(a.opacity <= .5)
        w.stop();
    }
})

OR

dojo.style("disabled_div", "opacity", "1"); 

var fadeArgs = {node: "disabled_div", duration: 3000,onAnimate:function(o){

 if(o.opacity <= .5){
   anim.stop()
 }
}};
anim =  dojo.fadeOut(fadeArgs);
anim.play();


You could use fadeTo from the DojoX extensions

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜