Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Eduardo Sucena

LOADING EM JS ?? tem como?

Recommended Posts

Aew galera, fiz um site onde as imagens mudam automaticamente num determinado periodo de tempo em segundos fornecido pelo usuário

 

 

LINK DA PAG QUE FIZ AQUI

 

O problema e dar loading nas fotos. Mtas vezes as fotos nao estao carregadas qdo solicitadas pelo script.

Ja coloquei aquela funcao do DREAM Weaver para dar loading nas fotos, mas parece que nao corrigiu definitivamente o problema.

 

Teria como fazer um LOADINg para as fotos e o script só comecar a rodar qdo estas já estivessem totalmente carregadas??

acho q já vi isso no site do PAPARAZOO.com.br

 

 

Espero respostas,,, Vle galera e até mais.

Compartilhar este post


Link para o post
Compartilhar em outros sites

tem como sim mas é meio complicado mas vou procurar pra você!the void

Compartilhar este post


Link para o post
Compartilhar em outros sites

Vlw Void..Ve se você acha isso pra mim. Deve ser treta mais é muito útil. Umagine você criar um loading até que suas imgs sejam carregadas na sua pag ? Iria ficar igual ~Sites em flash... mto loucos.estou trabalhando num Loading aqui. Por enquanto é só uma animação mesmo, mas quero ver se vinculo ela com esse cod q você vai me passar. Tomara que você ache =] :D Void, qq coisa estou no icq >>128830721>> msn edusucena@hotmail.comflw e vlw pela atenção :D

Compartilhar este post


Link para o post
Compartilhar em outros sites

não é meu eu achei e to te passando pra você olhar como q é

 

<html><head><title>Preload Image Page</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link rel="stylesheet" href="styles.css"><script language="JavaScript1.2">startingColor = new Array() // <-- Do not modify!endingColor = new Array() // <-- Do not modify!// YOU MAY MODIFY THE FOLLOWING:var yourImages = new Array("gfx/decta01.jpg", "gfx/line.gif", "gfx/michaelgraf01.jpg", "gfx/michaelgraf02.jpg", "gfx/michaelgraf03.jpg", "gfx/michaelgraf04.jpg", "gfx/michaelgraf05.jpg", "gfx/michaelgraf06.jpg", "gfx/decta02.jpg", "gfx/decta03.jpg", "gfx/wu01.jpg", "gfx/gecko01.jpg", "gfx/maybeyou.gif", "gfx/neo01.jpg", "gfx/wu02.jpg", "gfx/neo03.jpg", "gfx/neo04.jpg", "gfx/neo02.jpg", "gfx/phunk01.jpg", "gfx/phunk02.jpg", "gfx/inder01.jpg", "gfx/xerver01.jpg", "gfx/spacer.gif", "gfx/bloob701.jpg", "gfx/bman01.jpg", "gfx/bman02.jpg") // Fill this array with the images you wish to preloadvar locationAfterPreload = "main.php" // The script will redirect here when the preloading finishes *successfully*var preloadbarWidth = 200 // The length of the preload bar. Should be greater than total amount of images you want to preload!var preloadbarHeight = 10 // The height of the gradient/preload barvar backgroundOfGradient = "#6B7C9C" // Default color while the preload bar is "filling up"// Color the preloadbar is starting with - enter 1st, 3rd and 5th numbers/letters of color codestartingColor[0] = "f" startingColor[1] = "f"startingColor[2] = "f"// Color the preloadbar is going to end up with - enter the 1st, 3rd and 5th numbers/letters of color codeendingColor[0] = "f"endingColor[1] = "f"endingColor[2] = "f"// FOR TROUBLESHOOTING:var gap = 3 // PLAY AROUND WITH THIS SETTING IF YOU GET A JAVASCRIPT ERROR!!! 2 is the minumum value!!!// DO NOT MODIFY ANYTHING BEYOND THIS POINT!!!if (!document.all) location.replace(locationAfterPreload)var a = 10, b = 11, c = 12, d = 13, e = 14, f=15, i, j, ones = new Array(), sixteens = new Array(), diff = new Array();var convert = new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"), imgLen = yourImages.length;var loaded = new Array(), preImages = new Array(), currCount = 0, pending = 0, h = 0, hilite = new Array(), cover = new Array();var num = Math.floor(preloadbarWidth/gap);for (i = 0; i < 3; i++) {	startingColor[i] = startingColor[i].toLowerCase();	endingColor[i] = endingColor[i].toLowerCase();	startingColor[i] = eval(startingColor[i]);	endingColor[i] = eval(endingColor[i]);	diff[i] = (endingColor[i]-startingColor[i])/num;	ones[i] = Math.floor(diff[i]);	sixteens[i] = Math.round((diff[i] - ones[i])*15);}endingColor[0] = 0;endingColor[1] = 0;endingColor[2] = 0;i = 0, j = 0;while (i <= num) {	hilite[i] = "#";	while (j < 3) {  hilite[i] += convert[startingColor[j]];  hilite[i] += convert[endingColor[j]];  startingColor[j] += ones[j];  endingColor[j] += sixteens[j];  if (endingColor[j] > 15) { 	 endingColor[j] -= 15; 	 startingColor[j]++;  }  j++;	}	j = 0;	i++;}function loadImages() {	for (i = 0; i < imgLen; i++) {  preImages[i] = new Image();  preImages[i].src = yourImages[i];  loaded[i] = 0;  cover[i] = Math.floor(num/imgLen)*(i+1)	}	cover[cover.length-1] += num%imgLen	checkLoad();}function checkLoad() {	if (pending) { changeto(); return }	if (currCount == imgLen) { location.replace(locationAfterPreload); return }	for (i = 0; i < imgLen; i++) {  if (!loaded[i] && preImages[i].complete) { 	 loaded[i] = 1; pending++; currCount++; 	 checkLoad(); 	 return;  }	}	setTimeout("checkLoad()",10);}function changeto() {	if (h+1 > cover[currCount-1]) {  var percent = Math.round(100/imgLen)*currCount;  if (percent > 100) while (percent != 100) percent--;  if (currCount == imgLen && percent < 100) percent = 100;  defaultStatus = "Loaded " + currCount + " out of " + imgLen + " images [" + percent + "%].";  pending--;  checkLoad();  return;	}	eval("document.all.cell" + (h+1) + ".style.backgroundColor = hilite[h]");;	h++;	setTimeout("changeto()",1);}defaultStatus = "Loaded 0 out of " + imgLen + " images [0%]."// end hiding --></script></head><body bgcolor="#000000" text="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><table width=100% height=100%><tr><td><center>Preloading Images (1364395 Bytes)<br><script language="JavaScript1.2"><!-- beging hidingdocument.write('<table border="1" bordercolor="#485266" cellpadding="0" cellspacing="0" width="' + preloadbarWidth + '"><tr height="' + preloadbarHeight + '" bgcolor="' + backgroundOfGradient + '">');for (i = 0; i < num; i++) {	document.write('<td bordercolorlight="75A0BD" bordercolordark="75A0BD" width="' + gap + '" id="cell' + (i+1) + '"></td>');}document.write('</tr></table>');loadImages();// end hiding --></script><a href="main.php">skip preloading</a></center></td></tr></table></body></html>

 

http://www.nulldesign.de/battlebay2/index.php

 

 

 

ta ai!

 

 

the void

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.