Forum Moderators: open

Message Too Old, No Replies

how to load text with time delay?

need to load animated gif before text appears

         

souleye

4:33 am on Apr 1, 2002 (gmt 0)



i guess there's a script to start a certain action at a point in time. i know you can do it in flash, but i'm not using flash. i would like my animated gif to finish loading, before the text that follows appears. i think i've seen it on a web site. any suggestion would be appreciated. thanks.
souleye

TeddyBare69

6:29 am on Apr 1, 2002 (gmt 0)



The two ways I have heard of doing this is:
1. Style sheets. You have <div tags around your graphic first and a second <div tag around your text. From what I have heard. The browsers are only supposed to do one at a time. Works great when you want the text first and then the graphic.

2. Second is to estimate how long the graphic will take to download and have a javascript timer set to execute in that many seconds.

I hope that helps.

souleye

5:30 pm on Apr 1, 2002 (gmt 0)



hi teddy,
you did, but you did not! lol. thanks for the heads up. i had seen <div> and i was wondering 'what in the hell'. i don't mess with style sheets, but i think it's high time i upgraded my html skill. i design from the point of view of 'graphic artist' rather than 'coder'- bad karma! but i knew there must be a javascript for it. now, where to find it, is THE question! once again, thanks.

TeddyBare69

9:54 pm on Apr 1, 2002 (gmt 0)



My bad, I wasn't sure what your background was so I tried my first explanation without possibly offending you.

Here goes for the javascript code

****Paste this code in the <HEAD> section of your HTML page****
<SCRIPT LANGUAGE="JavaScript">
var res = null;
var timeout_val = 10;

res = setTimeout("timer_func()", timeout_val );

timer_func {
textDiv.visibility="visible";
}
</SCRIPT>
**** End of Javascript timer function ***

It has been a long time so I am not 100%. The page were I learned it is [htmlguru.com...] An incredible site to look at. He teaches how to use style sheets and javascript to have animated pages. If the example above doesn't work let me know and I will do better research. Don't forget to create your text <DIV> object and call it "textDiv" in the body of the html.

souleye

10:02 pm on Apr 1, 2002 (gmt 0)



thank you very much. web design is making our life miserable. lol. i was gonna email you. i spent half afternoon, dusting off javascript, html reference books. i found out that between the event handler 'onload' and the method 'document.write', you can let the image load entirely then write to the document at position x,y... i need some tea to piece it together. when i get it right, i'll let you know. meantime, i'm gonna try your code. thanks again.

TeddyBare69

10:11 pm on Apr 1, 2002 (gmt 0)



If that code doesn't work than check out [pageresource.com...]

A full description of the setTimeout function in javascript. You will still have problems with figuring out how long it will take the client to download and start the animated gif. One thing you could do is like a splash screen that shows for 15 seconds. So no matter if it is cable modem or 14.4 phone modem, the splash screen will sit there while your text and animated graphic loads. Make sure you give the customer something to do while they are wait and there is a better chance they won't leave.

TeddyBare69

12:00 am on Apr 2, 2002 (gmt 0)



One other suggestion that I just read about but am not sure.

Tables, have a table that your graphic is in first and then another table inside it with your text.

From what I read, a table won't show until the whole table is loaded. So with one table inside the other you shouldn't see anything until all the contents is loaded.

I haven't tested this to see if it actually works though, just read it.

tedster

1:42 am on Apr 2, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Differnt browsers will be different on this. No hard and fast rules you can depend on to create a specific effect for the end user.