This doesn't help if you do display:none in external CSS. This overrides
the default setting of the element, and you've no clue afterwards if it
should be "block", "inline", etc.
CSS should provide a general "render or render not" switch, but
doesn't. :(
-Thomas
Am 06.09.2006 um 15:42 schrieb Sam Foster:
>
> I know this maybe got done to death already, but I didnt see a
> definitive answer. I'm not sure if this is one either, but its more
> food
> for thought.
> IIRC Prototype's hide() sets style.display to none, and show() sets it
> to ''. The empty string then allows any display property in a
> class to
> apply. So if your stylesheet specifies .someElement { display:
> none; },
> $('elm').show() wont actually work.
> The reason show() sets display to the empty string instead of 'block'
> for example, is that block isn't the right value for lots of elements
> (inline elements, table rows etc). So a "better" approach might be to
> check the currentStyle/calculatedStyle objects where the *actual*
> display property is available (once all the various inheritance has
> been
> resolved at rendertime), and remember before setting to 'none', and
> restore that value later, when you call show();
>
> This would likely be slower, and the added complexity would surely
> trip
> someone up somewhere. On the other hand, that's why we have
> libraries -
> to solve these kinds of problems for us - so it might be worth
> exploration. I ran into this about this time last year though, so
> surely
> its been explored more since then?
>
> (yet another) Sam
>
> Sam wrote:
>
>> The one and only way to pre-hide stuff with Prototype and therefore
>> script.aculo.us is a small sin: use inline style="display: none" on
>> your element's HTML.
>> --------------------------------------
>> I discovered this by trial-and-error myself, but I never took it
>> so far as to understand *why* hiding a div with a class doesn't
>> work with Effect.Grow.
>>
>> Anyone know?
>>
>> Sam
>>
>> .hide {display:none}
>>
>> <div class=".hide">... Whatever</div>
>>
>>
>>
>>
>>>
>>
>>
>>
>>
>>
>
>
> >
--
Thomas Fuchs
wollzelle
http://www.wollzelle.com
questentier on AIM
madrobby on irc.freenode.net
http://www.fluxiom.com :: online digital asset management
http://script.aculo.us :: Web 2.0 JavaScript
http://mir.aculo.us :: Where no web developer has gone before
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs
-~----------~----~----~----~------~----~------~--~---