PDA

View Full Version : Opacity level and animated show...



jt
13 Feb 2007, 11:52 AM
I have tried searching for a similar issue and couldn't find one so I thought I would post.

The problem I am having is I am trying to create a mask over an area on the page that fades in and out when the user clicks on a checkbox.


After the page is loaded I do:

getEl('mask').setOpacity(.5);

and once the user clicks a checkbox I would do:

if (e.getTarget().checked) {
getEl('mask').hide(true);
} else {
getEl('mask').show(true);
}

The 'hide' works as it should and fades out, but the 'show' fades in past the opacity level set and continues until opacity == 1 (solid looking DIV).

If there is an opacity set on an object, should the fade in stop when it hits the opacity level for the element?

Animal
14 Feb 2007, 3:10 AM
It currently does not do that. You'll have to animate the opacity yourself.

You could file an enhancement request to ask that that Element.show takes a numeric opacity value as an optional second parameter, and passes it as the first parameter to Element.setVisible.

And that Element.setVisible allows a numeric as parameter 1 which is the opacity level to animate to. 0 means hide. Boolean values would continue to work as normal.

I think it's a nice enhancement...