Login Register

fadeOut doesn't work

I can't use dojo fadeOut.
Please, see my html:

Hide me!

Please, see my js:

function fadeOutDiv(){
        alert("fadeOutDiv()");
                //dojo.fadeOut({ //no func
                //dojo.style.getOpacity problem no function
        var div = dojo.byId("fadeOutDivId");
        div.style.opacity = 1;
        alert("Opacity 1 = " + div.style.opacity);
        alert("id 1 = " + div.id);
        dojo.lfx.html.fadeOut({
                node: dojo.byId("fadeOutDivId").domNode,
                duration: 2000
                }).play();
}

I get this error inside fireBug console:
node.style has no properties
getOpacity(Object duration=2000)dojo.js (line 2344)
start()dojo.js (line 4022)
(no name)(Object property=opacity end=0, 0)dojo.js (line 3944)
forEach([Object property=opacity end=0], function(), Object _properties=[1] diffs=[1])dojo.js (line 3127)
_3cf([Object property=opacity end=0])dojo.js (line 3959)
beforeBegin()dojo.js (line 3983)
(no name)()dojo.js (line 3353)
(no name)()dojo.js (line 3512)
(no name)()dojo.js (line 3511)
fire("beforeBegin", undefined)dojo.js (line 3518)
play(undefined, undefined)dojo.js (line 3582)
fadeOutDiv()admindojostuff.js (line 28)
onclick(click clientX=0, clientY=0)PrepareLawDraft.a... (line 1)
[Break on this error] var opac=node.style.opacity||node.style.MozOpacity||node.style.KhtmlOpacity||1;

What's going on? I can't understand. Please, help

you are using 0.4 function

you are using 0.4 function names, but it looks like you have a 1.0+ dojo.js ... what does dojo.version.toString() say?

you probably want:
dojo.style("fadeOutDiv", "opacity", 1); dojo.fadeOut({ node:"fadeOutDiv" }).play()

the div.style.opacity = 1 will not work in IE6

Yes, I know difference

Yes, I know difference between opacity and filter alpha.
I'll try to use your solution, thank you!

i just meant dojo.style does

i just meant dojo.style does the filter/opacity forking for you ... it's also worth noting that if you have a filter: in css to make the node hidden, fadeOut will behave oddly because style adds another filter. i typically set visibility:hidden and use dojo.style() to do the hard work.