OK, I'll explain this code, hopefully it's what you want.

Observe is a prototype method to set event callbacks.  So,
document.observe sets an event callback on the document.  It takes two
arguments, the event name and a function (either name or literal as is
used in the example).  We are setting a callback for "dom:loaded"
which is an event prototype adds to the document to indicate that all
nodes are available to javascript.  Inside that function you can place
any javascript you want called after the DOM is available.  For
example, anything that you want to use script.aculo.us effects on you
can call with like this:  new Effect.Appear("idhere"), for multiple
nodes you can call them all within that function.  If you want more
effects on the same node but want them all to run at once, just call
them all in that function.  Fill it out with all the onload effects
you want.  If on the other hand you want them to run one at a time on
the node, then you want to use the afterFinish callback like this:
new Effect.Appear("idhere", { afterFinish: function(effect) { new
Effect.Highlight(effect.element) } })

Hopefully this will get you headed in the right direction.

On Tue, Jul 28, 2009 at 12:09 PM, DJ Mangus<[email protected]> wrote:
> document.observe("dom:loaded", function() {
>  // initially hide all containers for tab content
>  $$('div.tabcontent').invoke('hide');
> });
>
> Note: you can of course do anything you want in that function.  The
> function runs when everything is loaded and available to javascript.
>
> On Tue, Jul 28, 2009 at 12:02 PM, dmcglone<[email protected]> wrote:
>>
>> Hi everyone,
>>
>> I'm new to scriptaculous and javascript. I've followed the examples
>> on
>> scriptaculous web site, but I can't find any examples implement the
>> events
>> without them being links, such as when the page loads.
>>
>> currently what I'm trying to do is make a block of text fade in on the
>> page
>> when it loads. I've already got 1 script that I am playing with that
>> zooms the
>> header in, and the only way It works is to add a tag to the body tag
>> of the
>> document This seems to not allow me to add other stuff to the page
>> unless they
>> are links.
>>
>> My goal is to learn how to load more than 1 element on a page with 2
>> or more
>> effects.
>>
>> My Google searches have turned up fruitless, does anyone know of any
>> good
>> tutorials or such?
>> >>
>>
>

--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to