...

View Full Version : loading progress bar



sybil6
12-11-2006, 10:36 PM
how is it possible to do a loading progress bar,the msot simple way, i read taht you can make this in a very simple way using the image class(with the image array) or also using the image array so all your pics would load when the site starts but i think the first solution is easier(loading bar), i have a very simple site that uses html and css and if any of you knew about this simple java script loading bar?

feras_wilson
12-11-2006, 10:49 PM
:thumbsup: Hi!
I found the script you wanted in this website:
http://www.dynamicdrive.com
http://www.dynamicdrive.com/dynamicindex11/dhtmlprogress.htm

HEHE!

kwhubby
12-12-2006, 02:17 AM
That dynamicdrive loading bar is time based, meaning it has nothing to do with if everything is loaded. I built a loading bar for images based on if they all loaded using document.images[].complete I found that each picture had to be loaded one by one into a hidden div to function properly.
From an old thread, I dug up this.
http://www.javascriptfr.com/code.aspx?ID=15834

If you want, I could build you a easy snippet of code, but I might not be able to get to it for a while. The code for a loading bar I am using has ugly code so I wouldn't give that to you right now.

sybil6
12-12-2006, 08:10 AM
thank you and what would be the code for loading all the images as the site starts?, i know that is pretty simple to do this with the image array class.

_Aerospace_Eng_
12-12-2006, 08:59 AM
That dynamicdrive loading bar is time based, meaning it has nothing to do with if everything is loaded. I built a loading bar for images based on if they all loaded using document.images[].complete I found that each picture had to be loaded one by one into a hidden div to function properly.
From an old thread, I dug up this.
http://www.javascriptfr.com/code.aspx?ID=15834

If you want, I could build you a easy snippet of code, but I might not be able to get to it for a while. The code for a loading bar I am using has ugly code so I wouldn't give that to you right now.

Its not time based. Both progress bar scripts found on dynamic drive use documnt.images[].oncomplete.

This is in the JS for the second version

function checkload(index){
(images[index].complete)? dispbars() : setTimeout('checkload('+index+')', 100);
}
Version 1 of that script uses this

function checkLoad() {
if (currCount == preImages.length) {
location.replace(locationAfterPreload)
return
}
for (i = 0; i <= preImages.length; i++) {
if (loaded[i] == false && preImages[i].complete) {
loaded[i] = true
eval("document.img" + currCount + ".src=dots[1].src")
currCount++
}
}
timerID = setTimeout("checkLoad()",10)
}

sybil6
12-12-2006, 11:13 PM
thank you, the function check load works quite good, i just put it in the html files that got heavy images.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum