Hi,

If the goal is to unhide __with an effect__ and you don't want to use
inline styles to hide them initially (I wouldn't want to; all those
"style='display: none'" attributes cluttering up my markup...), here
are a few ideas:

* Add an 'h' style to your stylesheet and change your current
class="dealerAddress" lines to class="dealerAddress h". Then at page
load time:

    var addresses;
    addresses = $$(".dealerAddress");
    addresses.invoke('hide');
    addresses.invoke('removeClassName', 'h');
    // ...and then fire off the scripty effects

This is probably my favorite, because it should be minimal impact on
several fronts. I normally don't like to visit lists of elements on
page load like that because on IE there's overhead involved in
extending them (extension is at the prototype -- small 'p' -- level in
other browsers and doesn't have that issue). But if you're going to
fire off a scripty effect anyway, you're going to have that overhead
anyway, so...

* Wrap them in a container that you hide. Then, at page load time:

    var container;
    container = $('containerId');
    container.select('.dealerAddress').invoke('hide');
    container.show();
    // ...and then fire off the scripty effects

* Do the stylesheet trick, but it's essentially the same thing: Start
off with the dealerAddress rule having display: none, then at page
load time:

    var addresses;
    addresses = $$(".dealerAddress");
    addresses.invoke('hide');
    // ...find the style sheet and rule and remove the display: none
    // ...fire off the scripty effects

HTH,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com

On Jan 28, 3:32 pm, kenxle <kenstcl...@gmail.com> wrote:
> Again, looking to unhide with an effect. Just changing class name
> won't allow me the effect. Or am I mistaken?
>
> On Jan 26, 4:13 pm, Diodeus <diod...@gmail.com> wrote:
>
>
>
> > Try: $$(".dealerAddress").each(function(element)
> > {element.removeClassName("dealerAddress")}); This will "unhide them".
> > Not sure if this will be any faster.
>
> > On Jan 26, 1:06 pm, kenxle <kenstcl...@gmail.com> wrote:
>
> > > Here's the problem I'm running into:
>
> > > $$(".dealerAddress").invoke("hide");
> > > takes too long because a very large page structure is loading, and
> > > there are many dealer addresses, so my page shows everything, then
> > > hides it, when it loads. Ew.
>
> > > To fix this, I put .dealerAddress{display:none;} in my CSS style
> > > sheet. However, when Prototype runs its show/hide functions (I'm using
> > > "toggle"), it only seems to be adding the attribute <...
> > > style="display:none"> or removing it. Which means that my style sheet
> > > takes back over when it removes the attribute, and the tag ends up
> > > never showing.
>
> > > I fixed it by putting my style declaration inline in the tag, as
> > > Prototype does, but I find this solution hackish and obtrusive. Why
> > > doesn't Prototype toggle from <... style="display:none"> to <...
> > > style="display:[inline||block]">? Wouldn't this solve my problem, as
> > > the inline style declaration would override the style sheet
> > > declaration?
>
> > > If so, I'd like to propose it as an update. Discussion or alternate
> > > solutions welcome.
>
> > > Thanks.
>
> > > (P.S. jQuery handles this situation without issue...)

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to