Closed Thread Icon

Preserved Topic: finished dling (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=18231" title="Pages that link to Preserved Topic: finished dling (Page 1 of 1)" rel="nofollow" >Preserved Topic: finished dling <span class="small">(Page 1 of 1)</span>\

 
YOUREanHTML
Nervous Wreck (II) Inmate

From: Pa, US
Insane since: Aug 2001

posted posted 08-09-2001 20:07

Does anyone know how I could check to see or wait until all the images and stuff that need to be downloaded are finished? I have stuff that uses the properties of the downloaded images, but it doesnt help much when it hasnt finished loading yet and gives me 0s for a width when it should be something else.

<script language="javascript">
...
var img = new Image();
img.src = "this.jpg";
...
obj.left = parseInt(img.width);
...
</sript>

I suppose I could calculate and input the stuff manually, but who wants to do something that crazy and time-consuming...

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 08-09-2001 20:12

<BODY ONLOAD="call your function here">

YOUREanHTML
Nervous Wreck (II) Inmate

From: Pa, US
Insane since: Aug 2001

posted posted 08-10-2001 01:45

um.. all the loading is done by a function called from <body onload>, and it loads all the images, then goes on to set the other initializing stuff I got going after it, but it isnt always done dling as it goes on to do the rest is what Im saying..

sorta basically like this:

fn_onload () {
fn_1 (); // loads images
fn_2 (); // does other initing
}

the loading started in fn_1() isnt done, but the code in fn_2() is executed anyway.. any clue what Im talking about?

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 08-10-2001 01:51

Ah, here's the thing. There's no point loading your page and then loading your images after - do it all at once! Put the contents of fn_1 in just regular script tags.

<script ... >
//set all images to be loaded here, basically just put the contents of fn_1() here.
</script>
<body onload="fn_2()">

This way, onload won't be called until everything has loaded, including the images.

YOUREanHTML
Nervous Wreck (II) Inmate

From: Pa, US
Insane since: Aug 2001

posted posted 08-10-2001 06:41

yeah.. that just might do it... thanks a lot!

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 08-10-2001 06:52

Actually there is a point to loading images after the page loads. If you have a lot of basic mouseovers and run a preloader before the page finishes loading it's going to hold up the loading of the rest of the page.

I like to have the page load and then use the onload event to fire the preloader.

I also don't allow any mouseovers to occur until the preloader is done.

Not really relevant to this discussion though. Just thought I'd mention it.





:[ Computers let you make more mistakes faster than any other invention in human history, with the possible exceptions of handguns and tequila. ]:

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 08-10-2001 14:24

I believe if you put the images to be loaded in script tags at the *end* of your page, they'll load last.

If you're desperate though, you can use the onload event of the image object to detect when each image has loaded, and when they've all loaded, call some function.

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 08-10-2001 14:55

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

YOUREanHTML
Nervous Wreck (II) Inmate

From: Pa, US
Insane since: Aug 2001

posted posted 08-10-2001 22:44

Thanks for the help... the only thing I couldnt figure out was where to put the document.images thing. It seemed to return true no matter where it was.

So.. this is what I ended up doing (um, how do I turn HTML on?):

------------------------------

<body ... onload="finishloading()">

<div id="loadbar" ... ></div>

<script language="javascript">
<!--
preload();
//-->
</script>

...
</body>

------------------------------


Using this, only part of the page will load before calling the preload() fn*, and the rest wont load until preload() is finished. Once the rest of the page is loaded, the <body onload> calls the finishloading() fn that will initialize and do whateverelse I need to do, and all the images from the preload will have finished dling by that time (at least it seems that way this time).

* my preloader uses the loadbar div to create a little loading percentage status bar thingy as it loads the images

As for the mouseover events, I find its best to have flags or checks or something for anything that isnt an always on sorta thing. Cant be too careful... loopholes are everywhere


Now Im just hoping what Ive got works in other browsers (Im using IE and sometimes aol)

[ retyped 6 times. I think the storm knocked out the electricity just so I would have to type this over and over again, especially since of the two pcs I have right here sitting next to each other, this one (and only those appliances that require me to set the time manually) was the only one to go off!

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 08-11-2001 01:32

(document.images) ? true:false

Will always return true if your browser supports it. It's not a method for testing for doneness.




:[ Computers let you make more mistakes faster than any other invention in human history, with the possible exceptions of handguns and tequila. ]:

« BackwardsOnwards »

Show Forum Drop Down Menu