PDA

View Full Version : Hide() always uses visibility



manugoel2003
3 Feb 2007, 12:23 AM
Hi, I am trying to hide an element but it seems to always use the Visibility property and not the Display property..... I have tried the few methods described in the docs and they didn't help.... here is what I am doing, any idea what mistake I am doing??

1) First I tried this on a button click (initially there is no display or visibility property set for the element in the css, so it is visible)

getEl("email_bottom").setVisibilityMode(Element.DISPLAY).toggle();
2) Then I explicitly set display as block in the CSS, and simply toggled it (without setVisibilityMode)
3) Then I used both
4) Then I read somewhere a way to enable Display property globally like this

YAHOO.ext.Element.prototype.autoDisplayMode = true;
5) I used various combinations of all three methods

I m not able to figure out what is wrong..... or is there any other method??

jack.slocum
3 Feb 2007, 1:31 AM
Did you try:

getEl("email_bottom").setVisibilityMode(YAHOO.ext.Element.DISPLAY).toggle();

That's hideous though (I would never type all that myself!).

You can also do:

getEl("email_bottom").enableDisplayMode().toggle();

or to force it to use block

getEl("email_bottom").enableDisplayMode('block').toggle();

or any of these variants:

getEl("email_bottom").setDisplayed(false);
getEl("email_bottom").setDisplayed('block');
getEl("email_bottom").setDisplayed(true);

autoDisplayMode was removed because it caused crashes in Safari and sometimes FF.

manugoel2003
3 Feb 2007, 2:15 AM
Ya this is working

getEl("email_bottom").enableDisplayMode('block').toggle();
Thanx Jack