It's a browser limitation.  If you set display: none in the css, when
you do:

$('id').style.display = '';

It doesn't revert the value to the default of block, inline, list-item,
or whatever.  It's like it forgets it magically.  Would be nice if every
item had a 'defaultDisplay' or something, so you could say:

$('id').style.display = $('id').style.defaultDisplay;

To revert it back to the default, but then you'd have problems when
dealing with altered display attributes like an inline element set to
display: block.  When you wanted to make it reappear, it would go back
to inline instead of block.

So... yeah, there's nothing you can do about it.

Greg

> -----Original Message-----
> From: [EMAIL PROTECTED]
[mailto:rails-spinoffs-
> [EMAIL PROTECTED] On Behalf Of Glenn Nilsson
> Sent: Wednesday, June 07, 2006 3:47 PM
> To: rails-spinoffs@lists.rubyonrails.org
> Subject: Re: [Rails-spinoffs] Scriptaculous Problem
> 
> As the documentation
> (http://wiki.script.aculo.us/scriptaculous/show/Effect.Appear) states:
> 
> "Effect.Appear
> 
> Make an element appear. If the element was previously set to
> display:none; inside the style attribute of the element, the effect
> will automatically show the element. This means that it must be places
> under the style attribute of an object, and not in the CSS in the head
> of the document or a linked file."
> 
> So no, you don't do anything wromng, but I agree, it would be rather
> nice not having to add that attribute.
> 
> /Glenn
> 
> On 6/7/06, Bryce Fischer <[EMAIL PROTECTED]> wrote:
> > The following works:
> >
> > <body>
> >         <a href="#" onclick="new Effect.Appear($('mydiv'));">Click
to
> display</a>
> >         <div class="example" id="mydiv" style="display: none;">
> >                 <h1>My Div</h1>
> >         </div>
> > </body>
> >
> > (style is inline)
> >
> > but the following does not:
> >
> > <head>
> >   ...
> >         <style>
> >                 #mydiv {
> >                         display: none;
> >                 }
> >         </style>
> > </head>
> > <body>
> > <body>
> >         <a href="#" onclick="new Effect.Appear($('mydiv'));">Click
to
> display</a>
> >         <div id="mydiv">
> >                 <h1>My Div</h1>
> >         </div>
> > </body>
> >
> > Am I doing something wrong?
> > _______________________________________________
> > Rails-spinoffs mailing list
> > Rails-spinoffs@lists.rubyonrails.org
> > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
> >
> _______________________________________________
> Rails-spinoffs mailing list
> Rails-spinoffs@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to