Hi Emma,
There are two parts to "onload"
1) The definition of the function. That's the bit
function onLoad() {
var eventSource = new Timeline.DefaultEventSource();
var bandInfos = [
... etc
}
2) The invocation or the calling of the function.
Normally this is done in the body element of the html page:
<body onload="onLoad();" onresize="onResize();">
However, since you are using Drupal, you can't easily change the body
statement of the template. So you need to call the function
explicitly.
Unfortunately, I was typing a bit fast when I sent the previous
message. -- While you could simply add "onLoad()"; to your script,
you'd probably run into problems: the Timeline script would be trying
to change the page before the page is fully loaded.
-- That's why the "onload" is used--the browser will only call the
function once the page has finished loading.
The good news is that there are Javascript libraries that can detect
when onload has happened. I recommend the Yahoo library since it is
professionally developed yet free to use (bsd license) and well
documented.
See http://developer.yahoo.com/yui/
Try adding the following to your page:
<script type="text/javascript" src="http://yui.yahooapis.com/combo?
2.6.0/build/yahoo/yahoo-min.js&2.6.0/build/event/event-min.js"></
script>
<script>
// all the Timeline stuff
function onLoad() {
...
}
// Then:
YAHOO.util.Event.onDOMReady(onLoad);
YAHOO.util.Event.addListener(window, 'resize', resize); // need to
deal with the resize function too
</script>
Good luck.
** Please be sure to send us the url when you're done so we can add it
to the list of Timeline examples.
Regards,
Larry
On Nov 10, 9:37 am, "Emma Jane O'Riordan"
<[EMAIL PROTECTED]> wrote:
> HI,
>
> Many thanks for your help.
>
> I have made the changes suggested, including moving the timeline.xml
> file to the same server, apart from the following:
>
> > 5) Since you probably can't change the body element of the Drupal
> > template:
> > To get your timeline going, just add
> > onLoad(); after your Timeline js.
>
> I am not sure what to put here. <onload();> alone does not make any
> difference but I am not sure what else the function is called, as I
> thought it was already being called with:
> <script>
> var tl;
> function onLoad() {
> var eventSource = new Timeline.DefaultEventSource();
> var bandInfos = [
> ...at the start of the timeline script?
>
> I might be being totally blonde here, I'm not very used to this sort
> of work yet! Your help is much appreciated!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"SIMILE Widgets" 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/simile-widgets?hl=en
-~----------~----~----~----~------~----~------~--~---